File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,6 +244,29 @@ suite('p5.Shader', function() {
244244 var curShader = myp5 . _renderer . states . userFillShader ;
245245 assert . isTrue ( curShader === null ) ;
246246 } ) ;
247+ test ( 'version() detects a #version directive' , function ( ) {
248+ const shader = myp5 . createShader (
249+ `
250+ #version 300 es
251+ precision highp float;
252+ attribute vec3 aPosition;
253+ uniform mat4 uModelViewMatrix;
254+ uniform mat4 uProjectionMatrix;
255+
256+ void main() {
257+ gl_Position = uProjectionMatrix * uModelViewMatrix * vec4(aPosition, 1.0);
258+ }
259+ ` ,
260+ `
261+ precision highp float;
262+
263+ void main() {
264+ gl_FragColor = vec4(1.0);
265+ }
266+ `
267+ ) ;
268+ assert . strictEqual ( shader . version ( ) , '300 es' ) ;
269+ } ) ;
247270 suite ( 'Hooks' , function ( ) {
248271 let myShader ;
249272 beforeEach ( function ( ) {
You can’t perform that action at this time.
0 commit comments