2 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
4 <title>WebGL test: Drawing with a null program
</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
8 <script src=
"driver-info.js"></script>
9 <script src=
"webgl-util.js"></script>
12 <script id=
"vs" type=
"x-shader/x-vertex">
16 gl_Position = vec4(
0.0,
0.0,
0.0,
1.0);
20 <script id=
"fs" type=
"x-shader/x-fragment">
22 precision mediump float;
25 gl_FragColor = vec4(
0.0,
1.0,
0.0,
1.0);
30 <canvas id=
"c" width=
"64" height=
"64"></canvas>
33 // Give ourselves a scope to return early from:
35 var gl
= c
.getContext('webgl');
37 todo(false, 'WebGL is unavailable.');
41 gl
.disable(gl
.DEPTH_TEST
);
43 var prog
= WebGLUtil
.createProgramByIds(gl
, 'vs', 'fs');
45 ok(false, 'Program linking should succeed.');
49 function checkGLError(func
, info
, refValue
) {
53 var error
= gl
.getError();
54 func(error
== refValue
,
55 '[' + info
+ '] gl.getError should be 0x' + refValue
.toString(16) +
56 ', was 0x' + error
.toString(16) + '.');
60 checkGLError(ok
, 'after setup');
63 gl
.drawArrays(gl
.POINTS
, 0, 1);
64 checkGLError(ok
, 'after non-null-program DrawArrays');
67 gl
.drawArrays(gl
.POINTS
, 0, 1);
68 checkGLError(ok
, 'after null-program DrawArrays', gl
.INVALID_OPERATION
);
70 ok(true, 'Test complete.');