OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 |
| 3 /* |
| 4 ** Copyright (c) 2012 The Khronos Group Inc. |
| 5 ** |
| 6 ** Permission is hereby granted, free of charge, to any person obtaining a |
| 7 ** copy of this software and/or associated documentation files (the |
| 8 ** "Materials"), to deal in the Materials without restriction, including |
| 9 ** without limitation the rights to use, copy, modify, merge, publish, |
| 10 ** distribute, sublicense, and/or sell copies of the Materials, and to |
| 11 ** permit persons to whom the Materials are furnished to do so, subject to |
| 12 ** the following conditions: |
| 13 ** |
| 14 ** The above copyright notice and this permission notice shall be included |
| 15 ** in all copies or substantial portions of the Materials. |
| 16 ** |
| 17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 24 */ |
| 25 |
| 26 --> |
| 27 |
| 28 <!DOCTYPE html> |
| 29 <html> |
| 30 <head> |
| 31 <meta charset="utf-8"> |
| 32 <title>WebGL BindBuffer conformance test.</title> |
| 33 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 34 <script src="../../resources/js-test-pre.js"></script> |
| 35 <script src="../resources/webgl-test.js"> </script> |
| 36 </head> |
| 37 <body> |
| 38 <canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"><
/canvas> |
| 39 <div id="description"></div> |
| 40 <div id="console"></div> |
| 41 <script> |
| 42 description("Checks a buffer can only be bound to 1 target."); |
| 43 |
| 44 debug(""); |
| 45 debug("Canvas.getContext"); |
| 46 |
| 47 var gl = create3DContext(document.getElementById("canvas")); |
| 48 if (!gl) { |
| 49 testFailed("context does not exist"); |
| 50 } else { |
| 51 testPassed("context exists"); |
| 52 |
| 53 debug(""); |
| 54 |
| 55 var buf = gl.createBuffer(); |
| 56 gl.bindBuffer(gl.ARRAY_BUFFER, buf); |
| 57 glErrorShouldBe(gl, gl.NO_ERROR, |
| 58 "should be able to bind buffer."); |
| 59 gl.bindBuffer(gl.ARRAY_BUFFER, null); |
| 60 glErrorShouldBe(gl, gl.NO_ERROR, |
| 61 "should be able to unbind buffer."); |
| 62 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf); |
| 63 glErrorShouldBe(gl, gl.INVALID_OPERATION, |
| 64 "should get INVALID_OPERATION if attempting to bind buffer to differ
ent target"); |
| 65 |
| 66 var buf = gl.createBuffer(); |
| 67 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf); |
| 68 glErrorShouldBe(gl, gl.NO_ERROR, |
| 69 "should be able to bind buffer."); |
| 70 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); |
| 71 glErrorShouldBe(gl, gl.NO_ERROR, |
| 72 "should be able to unbind buffer."); |
| 73 gl.bindBuffer(gl.ARRAY_BUFFER, buf); |
| 74 glErrorShouldBe(gl, gl.INVALID_OPERATION, |
| 75 "should get INVALID_OPERATION if attempting to bind buffer to differ
ent target"); |
| 76 } |
| 77 |
| 78 debug(""); |
| 79 successfullyParsed = true; |
| 80 </script> |
| 81 <script src="../../resources/js-test-post.js"></script> |
| 82 |
| 83 </body> |
| 84 </html> |
| 85 |
OLD | NEW |