| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <meta charset="utf-8"> | |
| 5 <title>WebGL texImage2D from WebGL conformance test.</title> | |
| 6 <script src="../../../resources/js-test.js"></script> | |
| 7 <script src="resources/webgl-test.js"> </script> | |
| 8 <script src="resources/webgl-test-utils.js"> </script> | |
| 9 </head> | |
| 10 <body> | |
| 11 <canvas id="example" width="256" height="16" style="width: 256px; height: 48px;"
></canvas> | |
| 12 <canvas id="source" width="256" height="16" style="width: 256px; height: 48px;">
</canvas> | |
| 13 <div id="description"></div> | |
| 14 <div id="console"></div> | |
| 15 <script> | |
| 16 description("Test texImage2D from a webgl canvas."); | |
| 17 var wtu = WebGLTestUtils; | |
| 18 var gl = wtu.create3DContext("example"); | |
| 19 gl.disable(gl.DITHER); | |
| 20 var program = wtu.setupTexturedQuad(gl); | |
| 21 var gl1 = wtu.create3DContext("source"); | |
| 22 gl1.disable(gl.DITHER); | |
| 23 | |
| 24 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); | |
| 25 glErrorShouldBe(gl1, gl1.NO_ERROR, "Should be no errors from setup."); | |
| 26 | |
| 27 gl.disable(gl.BLEND); | |
| 28 gl.disable(gl.DEPTH_TEST); | |
| 29 | |
| 30 gl1.clearColor(1.0, 0.0, 0.0, 1.0); | |
| 31 gl1.clear(gl1.COLOR_BUFFER_BIT); | |
| 32 | |
| 33 var tex = gl.createTexture(); | |
| 34 gl.bindTexture(gl.TEXTURE_2D, tex); | |
| 35 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, gl1.canvas); | |
| 36 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); | |
| 37 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); | |
| 38 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); | |
| 39 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); | |
| 40 wtu.drawQuad(gl); | |
| 41 | |
| 42 wtu.checkCanvas(gl, [255, 0, 0, 255], "Canvas should be red"); | |
| 43 | |
| 44 gl1.clearColor(0.0, 1.0, 0.0, 1.0); | |
| 45 gl1.clear(gl1.COLOR_BUFFER_BIT); | |
| 46 | |
| 47 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, gl1.canvas); | |
| 48 wtu.drawQuad(gl); | |
| 49 | |
| 50 wtu.checkCanvas(gl, [0, 255, 0, 255], "Canvas should be green"); | |
| 51 | |
| 52 debug(""); | |
| 53 successfullyParsed = true; | |
| 54 </script> | |
| 55 </body> | |
| 56 </html> | |
| 57 | |
| OLD | NEW |