3 <script src="../../js/resources/js-test-pre.js"></script>
4 <script src="resources/webgl-test.js"></script>
5 <script src="resources/webgl-test-utils.js"> </script>
8 <div id="description"></div>
9 <div id="console"></div>
11 description("Checks that painting WebGL contents doesn't pollute the context state.");
13 var wtu = WebGLTestUtils;
15 if (window.layoutTestController) {
16 layoutTestController.dumpAsText();
17 layoutTestController.waitUntilDone();
22 var requestAnimationFrame;
25 // Draw a blue quad to the screen. The compositor should have executed
26 // before reaching this point. If the texture state was corruted, then
27 // a red quad will be drawn. See crbug.com/105045.
28 wtu.drawQuad(context);
30 wtu.checkCanvasRect(context, 0, 0, 1, 1, [0, 0, 255, 255], "Should have rendered blue.", 1);
31 if (window.layoutTestController)
32 layoutTestController.notifyDone();
35 window.onload = function()
37 if (window.initNonKhronosFramework) {
38 window.initNonKhronosFramework(false);
41 canvas = document.getElementById("webgl-canvas");
42 canvas.width = 50; canvas.height = 50;
43 context = create3DContext(canvas);
45 requestAnimationFrame = window.webkitRequestAnimationFrame
47 var program = wtu.setupTexturedQuad(context);
48 var bufferObjects = wtu.setupUnitQuad(context);
49 var texture = wtu.createColoredTexture(context, 1, 1, [0, 0, 255, 255]);
51 context.uniform1i(context.getUniformLocation(program, "tex"), 0);
53 context.activeTexture(context.TEXTURE_0 + 5);
54 context.bindTexture(context.TEXTURE_2D, texture);
56 context.viewport(0, 0, canvas.width, canvas.height);
58 context.clearColor(255, 0, 0, 255);
59 context.clear(context.COLOR_BUFFER_BIT | context.DEPTH_BUFFER_BIT);
61 // We need to ensure that the compositor has run before the drawing
63 setTimeout(draw, 100);
66 <script src="../../js/resources/js-test-post.js"></script>
67 <canvas id="webgl-canvas" width="32px" height="32px"></canvas>