5 <title>Bug
1426289 - vertexAttrib4f should actually update.
</title>
6 <script src='/tests/SimpleTest/SimpleTest.js'
></script>
7 <link rel='stylesheet' href='/tests/SimpleTest/test.css'
>
8 <script src='webgl-util.js'
></script>
11 <script id='eVertSource' type='none'
>
12 attribute vec4 aColor;
17 gl_Position = vec4(vec3(
0.0),
1.0);
21 <script id='eFragSource' type='none'
>
22 precision mediump float;
26 gl_FragColor = vColor;
30 const canvas
= document
.createElement('canvas');
33 const gl
= canvas
.getContext('webgl');
35 const prog
= WebGLUtil
.linkProgramByIds(gl
, eVertSource
, eFragSource
);
39 const data
= new Uint32Array(1);
40 gl
.readPixels(0, 0, 1, 1, gl
.RGBA
, gl
.UNSIGNED_BYTE
, new Uint8Array(data
.buffer
));
41 return data
[0] & 0xffffff;
44 gl
.clearColor(0.0, 0.0, 0.0, 1.0);
45 gl
.clear(gl
.COLOR_BUFFER_BIT
);
47 ok(was
== 0x000000, '0x'+was
.toString(16));
49 gl
.disableVertexAttribArray(prog
.aColor
);
51 gl
.vertexAttrib4f(prog
.aColor
, 1, 0, 0, 1);
52 gl
.drawArrays(gl
.POINTS
, 0, 1);
54 ok(was
== 0x0000ff, '0x'+was
.toString(16));
56 gl
.vertexAttrib4f(prog
.aColor
, 0, 1, 0, 1);
57 gl
.drawArrays(gl
.POINTS
, 0, 1);
59 ok(was
== 0x00ff00, '0x'+was
.toString(16));