Uniform arrays in Chrome / Firefox

Hi,

Do uniform arrays work in Chrome or Firefox? A shader with a uniform array of floats, e.g.,

uniform float u_float[2];

Works ok in both browsers, but a uniform array of vec2, e.g.,

uniform vec2 u_vec2[2];

Does not work in either browser. In Chrome, the shader fails to link with no message in the link log. In Firefox, it compiles and links but the uniform cannot be queried.

After reading the OpenGL ES 2 and WebGL spec, I expect this to work.

Regards,
Patrick

Sorry, I forgot to mention that I am running Vista 64 with an ATI Radeon HD 5870.

Patrick

You might want to read this previous thread (especially the posts towards the bottom):

[viewtopic.php?f=35&t=3663](http://www.khronos.org/message_boards/viewtopic.php?f=35&t=3663)

I have not tried to make an array of vec2’s - but the example I posted to that thread uses an array of 4x4 matrices - which is a pretty similar issue.

I have not (personally) tried an ATI/Vista combination - but several thousand people have successfully played my WebGL game (here: http://tubagames.net ) - which uses arrays of matrices to do skin/bones transforms for the animation of characters in the game. If that game works for you - then you’ll know it’s not a problem for your hardware/software setup.

I suspect you have a problem elsewhere - but it’s hard to know without more information.

– Steve

Hi Steve,

Nice job with your game. The following shader using an array uniform compiles and links in Chrome:


uniform vec2 u_vec2[2];
void main()
{
  gl_Position = vec4(u_vec2[0], 0.0, 0.0) * vec4(u_vec2[1], 0.0, 0.0); 
}

But if I use two uniform arrays (one float and one vec2), it does not compile/link and the logs are empty:


uniform float u_float[2];
uniform vec2 u_vec2[2];
void main() 
{ 
  gl_Position = vec4(u_float[0]) * vec4(u_float[1]) * vec4(u_vec2[0], 0.0, 0.0) * vec4(u_vec2[1], 0.0, 0.0);
}

These are just unit tests, not production code.

Regards,
Patrick

I thought the problem was I am not including an attribute input, e.g., attribute vec4 position, but I can’t find anything in the GLSL spec that says one is required. I tried to add it anyway and it didn’t help.

Patrick

Just to follow up, uniform arrays are working perfectly fine in Chrome and Firefox. I am embarrassed to say that I was not even calling glUniform2fv() in the vec2 case. Shame on me.

Patrick