1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/conformance/rendering/gl-clear.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +<!-- 1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.6 +Use of this source code is governed by a BSD-style license that can be 1.7 + found in the LICENSE file. 1.8 + --> 1.9 +<!DOCTYPE html> 1.10 +<html> 1.11 +<head> 1.12 +<meta charset="utf-8"> 1.13 +<title>WebGL clear conformance test.</title> 1.14 +<link rel="stylesheet" href="../../resources/js-test-style.css"/> 1.15 +<script src="../../resources/js-test-pre.js"></script> 1.16 +<script src="../resources/webgl-test.js"> </script> 1.17 +<script src="../resources/webgl-test-utils.js"> </script> 1.18 +</head> 1.19 +<body> 1.20 +<canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></canvas> 1.21 +<div id="description"></div><div id="console"></div> 1.22 +<script> 1.23 +description("Test clear."); 1.24 +var wtu = WebGLTestUtils; 1.25 +var gl = wtu.create3DContext("example"); 1.26 +var program = wtu.setupTexturedQuad(gl); 1.27 + 1.28 +glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); 1.29 +wtu.checkCanvas(gl, [0,0,0,0], "should be 0,0,0,0"); 1.30 + 1.31 +gl.clearColor(1,1,1,1); 1.32 +gl.clear(gl.COLOR_BUFFER_BIT); 1.33 +wtu.checkCanvas(gl, [255,255,255,255], "should be 255,255,255,255"); 1.34 + 1.35 +gl.clearColor(0,0,0,0); 1.36 +gl.clear(gl.COLOR_BUFFER_BIT); 1.37 +wtu.checkCanvas(gl, [0,0,0,0], "should be 0,0,0,0"); 1.38 + 1.39 +gl.colorMask(false, false, false, true); 1.40 +gl.clearColor(1,1,1,1); 1.41 +gl.clear(gl.COLOR_BUFFER_BIT); 1.42 +wtu.checkCanvas(gl, [0,0,0,255], "should be 0,0,0,255"); 1.43 + 1.44 +var tex = gl.createTexture(); 1.45 + gl.bindTexture(gl.TEXTURE_2D, tex); 1.46 + gl.texImage2D( 1.47 + gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, 1.48 + new Uint8Array([128, 128, 128, 192])); 1.49 + 1.50 +gl.disable(gl.DEPTH_TEST); 1.51 +gl.disable(gl.BLEND); 1.52 +gl.colorMask(true, true, true, true); 1.53 +gl.drawArrays(gl.TRIANGLES, 0, 6); 1.54 +wtu.checkCanvas(gl, [128,128,128,192], "should be 128,128,128,192"); 1.55 + 1.56 +gl.colorMask(false, false, false, true); 1.57 +gl.clearColor(1,1,1,1); 1.58 +gl.clear(gl.COLOR_BUFFER_BIT); 1.59 +wtu.checkCanvas(gl, [128,128,128,255], "should be 128,128,128,255"); 1.60 + 1.61 +// TODO: Test depth and stencil clearing. 1.62 + 1.63 +debug(""); 1.64 +successfullyParsed = true; 1.65 +</script> 1.66 +<script>finishTest();</script> 1.67 +</body> 1.68 +</html> 1.69 +