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
);
47 gl
.scissor(0, 75, 50, 50);
48 gl
.clearColor(0.0, 0.0, 1.0, 1.0);
49 gl
.clear(gl
.COLOR_BUFFER_BIT
);
52 ////////////////////////////////////////////////////////////////////////////////
55 var TIMEOUT_MS
= 30 * 1000;
57 function setStatus(text
) {
58 var elem
= document
.getElementById('status');
59 elem
.innerHTML
= text
;
62 var gIsComplete
= false;
64 function markComplete(statusText
) {
72 setStatus(statusText
);
73 document
.documentElement
.removeAttribute('class');
76 function markError(text
) {
77 markComplete('Error: ' + text
);
80 function markTimedOut() {
81 markError('Timed out waiting on test completion.');
84 function runFrame(gl
, frameCount
, maxFrameCount
) {
88 if (frameCount
>= maxFrameCount
) {
89 console
.log('Rendered ' + frameCount
+ ' frames.');
94 requestAnimationFrame(function(){
95 runFrame(gl
, frameCount
, maxFrameCount
);
100 var canvas
= document
.getElementById('canvas');
102 var gl
= initGL(canvas
);
104 markError('WebGL context creation failed.');
108 var maxFrameCount
= arg('frame', 1);
109 if (maxFrameCount
< 1) {
110 markError('Invalid `frame` arg: ' + maxFrameCount
);
114 setStatus('Waiting...');
116 runFrame(gl
, 0, maxFrameCount
);
117 setTimeout(markTimedOut
, TIMEOUT_MS
);
122 <body onload='runTest();'
>
123 <canvas style=
"position:fixed; left: 0px; top: 0px;" id='canvas' width='
200' height='
200'
></canvas>
124 <div id='status'
></div>