| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="resources/webgl-test.js"></script> |
| <script src="resources/webgl-test-utils.js"></script> |
| <script> |
| var wtu = WebGLTestUtils; |
| var gl = null; |
| var textureLoc = null; |
| |
| function init() |
| { |
| if (window.initNonKhronosFramework) |
| window.initNonKhronosFramework(true); |
| |
| description('Verify we can handle 2 sample per pixel images (e.g. greyscale with alpha)'); |
| |
| gl = wtu.create3DContext("example"); |
| |
| var program = wtu.setupTexturedQuad(gl); |
| |
| gl.clearColor(0,0,0,1); |
| gl.clearDepth(1); |
| |
| textureLoc = gl.getUniformLocation(program, "tex"); |
| wtu.loadTexture(gl, "resources/greyscale.png", runTest); |
| } |
| |
| function runTest() |
| { |
| glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors"); |
| |
| debug('Testing texImage2D'); |
| gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
| // Point the uniform sampler to texture unit 0 |
| gl.uniform1i(textureLoc, 0); |
| // Draw the triangles |
| wtu.drawQuad(gl, [0, 0, 0, 255]); |
| finishTest(); |
| } |
| |
| </script> |
| </head> |
| <body onload='init()'> |
| <canvas id="example" width="32px" height="32px"></canvas> |
| <div id="description"></div> |
| <div id="console"></div> |
| </body> |
| </html> |