6 Clear the four quadrants of the canvas as follows:
15 Clear with a given alpha value. What effect this has depends on the
16 context-creation args passed to this page.
18 <html class='reftest-wait'
>
21 <script type='text/javascript' src='webgl-utils.js'
></script>
22 <script type='text/javascript'
>
25 var COLOR_VALUE
= 127.0 / 255.0;
26 var ALPHA_VALUE
= 127.0 / 255.0;
28 function renderFrame(gl
) {
29 gl
.enable(gl
.SCISSOR_TEST
);
31 gl
.scissor(0, 0, 100, 100);
32 gl
.clearColor(COLOR_VALUE
, 0.0, 0.0, ALPHA_VALUE
);
33 gl
.clear(gl
.COLOR_BUFFER_BIT
);
35 gl
.scissor(100, 0, 100, 100);
36 gl
.clearColor(0.0, COLOR_VALUE
, 0.0, ALPHA_VALUE
);
37 gl
.clear(gl
.COLOR_BUFFER_BIT
);
39 gl
.scissor(0, 100, 100, 100);
40 gl
.clearColor(0.0, 0.0, COLOR_VALUE
, ALPHA_VALUE
);
41 gl
.clear(gl
.COLOR_BUFFER_BIT
);
43 gl
.scissor(100, 100, 100, 100);
44 gl
.clearColor(0.0, 0.0, 0.0, ALPHA_VALUE
);
45 gl
.clear(gl
.COLOR_BUFFER_BIT
);
48 ////////////////////////////////////////////////////////////////////////////////
51 var TIMEOUT_MS
= 30 * 1000;
53 function setStatus(text
) {
54 var elem
= document
.getElementById('status');
55 elem
.innerHTML
= text
;
58 var gIsComplete
= false;
60 function markComplete(statusText
) {
68 setStatus(statusText
);
69 document
.documentElement
.removeAttribute('class');
72 function markError(text
) {
73 markComplete('Error: ' + text
);
76 function markTimedOut() {
77 markError('Timed out waiting on test completion.');
80 function runFrame(gl
, frameCount
, maxFrameCount
) {
84 if (frameCount
>= maxFrameCount
) {
85 console
.log('Rendered ' + frameCount
+ ' frames.');
90 requestAnimationFrame(function(){
91 runFrame(gl
, frameCount
, maxFrameCount
);
96 var canvas
= document
.getElementById('canvas');
98 var gl
= initGL(canvas
);
100 markError('WebGL context creation failed.');
104 var maxFrameCount
= arg('frame', 1);
105 if (maxFrameCount
< 1) {
106 markError('Invalid `frame` arg: ' + maxFrameCount
);
110 setStatus('Waiting...');
112 runFrame(gl
, 0, maxFrameCount
);
113 setTimeout(markTimedOut
, TIMEOUT_MS
);
118 <body onload='runTest();'
>
119 <canvas style=
"position:fixed; left: 0px; top: 0px;" id='canvas' width='
200' height='
200'
></canvas>
120 <div style=
"display:block; background-color: blue; position: fixed; top: 75px; left: 0px; width: 50px; height: 50px;"></div>
121 <div id='status'
></div>