PDA

View Full Version : Uniform arrays in Chrome / Firefox



pjcozzi
03-18-2011, 08:26 AM
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

pjcozzi
03-18-2011, 10:36 AM
Sorry, I forgot to mention that I am running Vista 64 with an ATI Radeon HD 5870.

Patrick

SteveBaker
03-18-2011, 12:37 PM
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

pjcozzi
03-21-2011, 09:01 AM
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

pjcozzi
03-21-2011, 09:08 AM
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

pjcozzi
04-15-2011, 02:36 PM
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

microapp
09-26-2011, 01:35 AM
Sorry, I forgot to mention that I am running Vista 64 with an ATI Radeon HD 5870.

Patrick
am having mixed results getting an output from this combination. I installed Vista Ultimate x64 using a CRT monitor. But, with XP it's just flawless.

Ifer
10-24-2011, 04:28 AM
Yeah, that's really true. I have also an annoying problem in Windows Vista when using a CRT monitor. When I start a game in full screen like Team Fortress 2 or often just by accessing something that triggers the UAP screen to confirm running as administrator
the picture on my monitor goes complete garbled.

Ambit_Energy
01-05-2012, 07:10 PM
HI Steve, new here may can you put link of your game as pjcozzi mentioned about. :D




---------------------------
http://ambitpros.com/ambit-versus/ambit-energy