| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 Use of this source code is governed by a BSD-style license that can be | |
| 4 found in the LICENSE file. | |
| 5 --> | |
| 6 <!DOCTYPE html> | |
| 7 <html> | |
| 8 <head> | |
| 9 <meta charset="utf-8"> | |
| 10 <title>WebGL clear conformance test.</title> | |
| 11 <link rel="stylesheet" href="../resources/js-test-style.css"/> | |
| 12 <script src="../resources/js-test-pre.js"></script> | |
| 13 <script src="resources/webgl-test.js"> </script> | |
| 14 <script src="resources/webgl-test-utils.js"> </script> | |
| 15 </head> | |
| 16 <body> | |
| 17 <canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></
canvas> | |
| 18 <div id="description"></div><div id="console"></div> | |
| 19 <script> | |
| 20 description("Test clear."); | |
| 21 var wtu = WebGLTestUtils; | |
| 22 var canvas = document.getElementById("example"); | |
| 23 var gl = wtu.create3DContext(canvas); | |
| 24 var program = wtu.setupTexturedQuad(gl); | |
| 25 | |
| 26 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); | |
| 27 wtu.checkCanvas(gl, [0,0,0,0], "should be 0,0,0,0"); | |
| 28 | |
| 29 gl.clearColor(1,1,1,1); | |
| 30 gl.clear(gl.COLOR_BUFFER_BIT); | |
| 31 wtu.checkCanvas(gl, [255,255,255,255], "should be 255,255,255,255"); | |
| 32 | |
| 33 gl.clearColor(0,0,0,0); | |
| 34 gl.clear(gl.COLOR_BUFFER_BIT); | |
| 35 wtu.checkCanvas(gl, [0,0,0,0], "should be 0,0,0,0"); | |
| 36 | |
| 37 gl.colorMask(false, false, false, true); | |
| 38 gl.clearColor(1,1,1,1); | |
| 39 gl.clear(gl.COLOR_BUFFER_BIT); | |
| 40 wtu.checkCanvas(gl, [0,0,0,255], "should be 0,0,0,255"); | |
| 41 | |
| 42 var tex = gl.createTexture(); | |
| 43 gl.bindTexture(gl.TEXTURE_2D, tex); | |
| 44 gl.texImage2D( | |
| 45 gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, | |
| 46 new Uint8Array([128, 128, 128, 192])); | |
| 47 | |
| 48 gl.disable(gl.DEPTH_TEST); | |
| 49 gl.disable(gl.BLEND); | |
| 50 gl.colorMask(true, true, true, true); | |
| 51 gl.drawArrays(gl.TRIANGLES, 0, 6); | |
| 52 wtu.checkCanvas(gl, [128,128,128,192], "should be 128,128,128,192"); | |
| 53 | |
| 54 gl.colorMask(false, false, false, true); | |
| 55 gl.clearColor(1,1,1,1); | |
| 56 gl.clear(gl.COLOR_BUFFER_BIT); | |
| 57 wtu.checkCanvas(gl, [128,128,128,255], "should be 128,128,128,255"); | |
| 58 | |
| 59 // TODO: Test depth and stencil clearing. | |
| 60 | |
| 61 debug(""); | |
| 62 successfullyParsed = true; | |
| 63 </script> | |
| 64 <script src="../resources/js-test-post.js"></script> | |
| 65 </body> | |
| 66 </html> | |
| 67 | |
| OLD | NEW |