1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
6 <title>WebGL uniformMatrix Conformance Tests
</title>
7 <script src=
"../../../resources/js-test.js"></script>
8 <script src=
"resources/webgl-test.js"></script>
11 <div id=
"description"></div>
12 <div id=
"console"></div>
13 <canvas id=
"example" width=
"2" height=
"2"> </canvas>
15 <script id=
"vshader" type=
"x-shader/x-vertex">
16 attribute vec4 vPosition;
22 gl_Position = vec4(vPosition.xyz, world3[
0].x + world2[
0].x) * world4;
26 <script id=
"fshader" type=
"x-shader/x-fragment">
29 gl_FragColor = vec4(
1.0,
0.0,
0.0,
1.0);
34 description("This test ensures WebGL implementations handle uniformMatrix in a OpenGL ES 2.0 spec compliant way");
37 debug("Checking gl.uniformMatrix.");
40 window
.internals
.settings
.setWebGLErrorsToConsoleEnabled(false);
42 gl
= initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1);
43 for (var ii
= 2; ii
<= 4; ++ii
) {
44 var loc
= gl
.getUniformLocation(gl
.program
, "world" + ii
);
46 for (var jj
= 0; jj
< ii
; ++jj
) {
47 for (var ll
= 0; ll
< ii
; ++ll
) {
48 if (jj
== ii
- 1 && ll
== ii
- 1)
50 matLess
[jj
* ii
+ ll
] = (jj
== ll
) ? 1 : 0;
53 var mat
= matLess
.concat([1]);
54 var matMore
= mat
.concat([1]);
55 name
= "uniformMatrix" + ii
+ "fv";
56 gl
[name
](loc
, false, matLess
);
57 glErrorShouldBe(gl
, gl
.INVALID_VALUE
, "should fail with insufficient array size for " + name
);
58 gl
[name
](loc
, false, mat
);
59 glErrorShouldBe(gl
, gl
.NO_ERROR
, "should succeed with correct array size for " + name
);
60 gl
[name
](loc
, false, matMore
);
61 glErrorShouldBe(gl
, gl
.INVALID_VALUE
, "should fail with more than 1 array size for " + name
);
64 gl
[name
](loc
, false, mat
);
65 glErrorShouldBe(gl
, gl
.NO_ERROR
, "can call " + name
+ "with transpose = false");
66 gl
[name
](loc
, true, mat
);
67 glErrorShouldBe(gl
, gl
.INVALID_VALUE
, name
+ " should return INVALID_VALUE with transpose = true");