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 "Texture Complete" texture 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 <script src="../resources/webgl-test-utils.js"></script> |
| 37 </head> |
| 38 <body> |
| 39 <canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"><
/canvas> |
| 40 <canvas id="canvas2d" width="16" height="16" style="width: 40px; height: 40px;">
</canvas> |
| 41 <div id="description"></div> |
| 42 <div id="console"></div> |
| 43 <script> |
| 44 function init() |
| 45 { |
| 46 if (window.initNonKhronosFramework) { |
| 47 window.initNonKhronosFramework(false); |
| 48 } |
| 49 |
| 50 description( |
| 51 "Checks that a texture that is not -texture-complete- does not draw if"+ |
| 52 " filtering needs mips"); |
| 53 |
| 54 var canvas2d = document.getElementById("canvas2d"); |
| 55 var ctx2d = canvas2d.getContext("2d"); |
| 56 ctx2d.fillStyle = "rgba(0,192,128,1)"; |
| 57 ctx2d.fillRect(0, 0, 16, 16); |
| 58 |
| 59 var wtu = WebGLTestUtils; |
| 60 var canvas = document.getElementById("example"); |
| 61 gl = wtu.create3DContext(canvas); |
| 62 var program = wtu.setupTexturedQuad(gl); |
| 63 |
| 64 gl.disable(gl.DEPTH_TEST); |
| 65 gl.disable(gl.BLEND); |
| 66 |
| 67 var tex = gl.createTexture(); |
| 68 gl.bindTexture(gl.TEXTURE_2D, tex); |
| 69 // 16x16 texture no mips |
| 70 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); |
| 71 |
| 72 var loc = gl.getUniformLocation(program, "tex"); |
| 73 gl.uniform1i(loc, 0); |
| 74 |
| 75 wtu.drawQuad(gl); |
| 76 wtu.checkCanvas(gl, [0,0,0,255], |
| 77 "texture that is not -texture-complete- when " + |
| 78 "TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255"); |
| 79 } |
| 80 |
| 81 init(); |
| 82 successfullyParsed = true; |
| 83 </script> |
| 84 |
| 85 <script src="../../resources/js-test-post.js"></script> |
| 86 |
| 87 </body> |
| 88 </html> |
| 89 |
OLD | NEW |