I’ve just noticed that the Windows dev channel for Chrome now supports WebGL, which is great news!
Less good news is that its support for uniform3fv differs from that in Firefox, and it’s not obvious which is correct. It appears to only accept proper WebGL buffer objects, not JavaScript lists (which is fair enough) but it also takes an extra size parameter.
In more detail: in Firefox I was doing something like:
gl.uniform3fv(gl.getUniformLocation(shaderProgram, "uAmbientColor"), [0.5, 0.5, 0.5]);
Now, changing it to
gl.uniform3fv(gl.getUniformLocation(shaderProgram, "uAmbientColor"), new WebGLFloatArray([0.5, 0.5, 0.5]));
…is probably an improvement anyway, so I’ll update my code accordingly. However, the above still won’t work on Chrome; to get it to work I need to do this:
gl.uniform3fv(gl.getUniformLocation(shaderProgram, "uAmbientColor"), new WebGLFloatArray([0.5, 0.5, 0.5]), 3);
…the last parameter being a size (as per uniform3fv chrome - Google Search). That last line works in Chrome, but unfortunately doesn’t work in Firefox.
Does anyone know which one is correct according to the latest version of the spec?
Cheers,
Giles