test getting names of uniforms8ms ‣
const {gl, tagObject} = createContext();
const prg = twgl.createProgram(gl, [
`
void main() {
gl_Position = vec4(0);
}
`,
`
precision mediump float;
uniform vec4 diffuseColor;
void main() {
gl_FragColor = diffuseColor;
}
`,
]);
tagObject(prg, 'simple program');
gl.useProgram(prg);
const loc = gl.getUniformLocation(prg, 'diffuseColor');
gl.uniform4fv(loc, [1, 2, 3, 4]);
assertThrowsWith(() => {
gl.uniform4fv(loc, [1, 2, 3 / 'foo', 4]);
}, [/diffuseColor.*?NaN/]);