render-no-enabled-attrib-arrays.html (1807B)
1 <!-- 2 Copyright (c) 2019 The Khronos Group Inc. 3 Use of this source code is governed by an MIT-style license that can be 4 found in the LICENSE.txt file. 5 --> 6 7 <!DOCTYPE html> 8 <html> 9 <head> 10 <title>Verify drawing without any enabled vertex attribute arrays</title> 11 <meta charset="utf-8"> 12 <link rel="stylesheet" href="../../resources/js-test-style.css"/> 13 <script src="../../js/js-test-pre.js"></script> 14 <script src="../../js/webgl-test-utils.js"></script> 15 <script id='vshader' type='x-shader/x-vertex'>#version 300 es 16 layout(location=0) in vec4 inColor; 17 out vec4 varyingColor; 18 void main() 19 { 20 varyingColor = inColor; 21 gl_Position = vec4(0.0, 0.0, 0.0, 1.0); 22 gl_PointSize = 1.0; 23 } 24 </script> 25 <script id='fshader' type='x-shader/x-fragment'>#version 300 es 26 precision mediump float; 27 in vec4 varyingColor; 28 layout(location=0) out vec4 oColor; 29 void main() 30 { 31 oColor = varyingColor; 32 } 33 </script> 34 <script> 35 "use strict"; 36 37 function runTest() { 38 var wtu = WebGLTestUtils; 39 var gl = wtu.create3DContext("testCanvas", undefined, 2); 40 if (!gl) { 41 testFailed('could not create context'); 42 return; 43 } 44 var program = wtu.setupProgram(gl, ['vshader', 'fshader']); 45 gl.disableVertexAttribArray(0); 46 gl.vertexAttrib4f(0, 0.0, 1.0, 0.0, 1.0); 47 gl.clearColor(1, 0, 0, 1); 48 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); 49 gl.drawArrays(gl.POINTS, 0, 1); 50 wtu.checkCanvas(gl, [ 0, 255, 0, 255 ], "Canvas should be covered by a single green point"); 51 } 52 </script> 53 </head> 54 <body> 55 <canvas id="testCanvas" width="1" height="1" style="width: 32px; height: 32px;"></canvas> 56 <div id="description"></div> 57 <div id="console"></div> 58 <script> 59 "use strict"; 60 description(); 61 runTest(); 62 var successfullyParsed = true; 63 </script> 64 <script src="../../js/js-test-post.js"></script> 65 </body> 66 </html>