| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
| 2 "http://www.w3.org/TR/html4/loose.dtd"> | |
| 3 <html> | |
| 4 <head> | |
| 5 <title>WebGL BindBuffer conformance test.</title> | |
| 6 <script src="../../../resources/js-test.js"></script> | |
| 7 <script src="resources/webgl-test.js"> </script> | |
| 8 </head> | |
| 9 <body> | |
| 10 <canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"><
/canvas> | |
| 11 <div id="description"></div> | |
| 12 <div id="console"></div> | |
| 13 <script> | |
| 14 description("Checks a buffer can only be bound to 1 target."); | |
| 15 | |
| 16 debug(""); | |
| 17 debug("Canvas.getContext"); | |
| 18 | |
| 19 if (window.internals) | |
| 20 window.internals.settings.setWebGLErrorsToConsoleEnabled(false); | |
| 21 | |
| 22 var gl = create3DContext(document.getElementById("canvas")); | |
| 23 if (!gl) { | |
| 24 testFailed("context does not exist"); | |
| 25 } else { | |
| 26 testPassed("context exists"); | |
| 27 | |
| 28 debug(""); | |
| 29 | |
| 30 var buf = gl.createBuffer(); | |
| 31 gl.bindBuffer(gl.ARRAY_BUFFER, buf); | |
| 32 assertMsg(gl.getError() == gl.NO_ERROR, | |
| 33 "should be able to bind buffer."); | |
| 34 gl.bindBuffer(gl.ARRAY_BUFFER, null); | |
| 35 assertMsg(gl.getError() == gl.NO_ERROR, | |
| 36 "should be able to unbind buffer."); | |
| 37 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf); | |
| 38 assertMsg(gl.getError() == gl.INVALID_OPERATION, | |
| 39 "should get INVALID_OPERATION if attempting to bind buffer to differ
ent target"); | |
| 40 | |
| 41 var buf = gl.createBuffer(); | |
| 42 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf); | |
| 43 assertMsg(gl.getError() == gl.NO_ERROR, | |
| 44 "should be able to bind buffer."); | |
| 45 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); | |
| 46 assertMsg(gl.getError() == gl.NO_ERROR, | |
| 47 "should be able to unbind buffer."); | |
| 48 gl.bindBuffer(gl.ARRAY_BUFFER, buf); | |
| 49 assertMsg(gl.getError() == gl.INVALID_OPERATION, | |
| 50 "should get INVALID_OPERATION if attempting to bind buffer to differ
ent target"); | |
| 51 } | |
| 52 | |
| 53 debug(""); | |
| 54 </script> | |
| 55 </body> | |
| 56 | |
| 57 <script> | |
| 58 </script> | |
| 59 | |
| 60 </body> | |
| 61 </html> | |
| 62 | |
| OLD | NEW |