| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../resources/js-test.js"></script> | |
| 4 <script src="resources/webgl-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <div id="description"></div> | |
| 8 <div id="console"></div> | |
| 9 | |
| 10 <script> | |
| 11 description('Tests that index validation for drawElements does not examine too m
any indices'); | |
| 12 | |
| 13 if (window.internals) | |
| 14 window.internals.settings.setWebGLErrorsToConsoleEnabled(false); | |
| 15 | |
| 16 var context = create3DContext(); | |
| 17 var program = loadStandardProgram(context); | |
| 18 | |
| 19 context.useProgram(program); | |
| 20 var vertexObject = context.createBuffer(); | |
| 21 context.enableVertexAttribArray(0); | |
| 22 context.bindBuffer(context.ARRAY_BUFFER, vertexObject); | |
| 23 // 4 vertices -> 2 triangles | |
| 24 context.bufferData(context.ARRAY_BUFFER, new Float32Array([ 0,0,0, 0,1,0, 1,0,0,
1,1,0 ]), context.STATIC_DRAW); | |
| 25 context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0); | |
| 26 | |
| 27 var indexObject = context.createBuffer(); | |
| 28 | |
| 29 debug("Test out of range indices") | |
| 30 context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, indexObject); | |
| 31 context.bufferData(context.ELEMENT_ARRAY_BUFFER, new Uint16Array([ 10000, 0, 1,
2, 3, 10000 ]), context.STATIC_DRAW); | |
| 32 shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.T
RIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 2)"); | |
| 33 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(
context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); | |
| 34 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(
context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); | |
| 35 | |
| 36 debug("") | |
| 37 </script> | |
| 38 | |
| 39 </body> | |
| 40 </html> | |
| OLD | NEW |