Problems on setting uniform array

in shader:
uniform vec3 BrickColor[2], MortarColor;
uniform vec2 BrickSize;
uniform vec2 BrickPct;

   uniform mat3  myMat;

in order to set these uniform, app do like this:
float fv[6] =
{
1.0, 0.3, 0.2,
0.5, 0.4, 0.6
};
float fm[9] =
{
1.0, 2.0, 3.0,
4.0, 5.0, 6.0,
7.0, 8.0, 9.0
};

     glUniformMatrix3fvARB(glGetUniformLocationARB(brickProg, "myMat"), 1, GL_FALSE, fm);
     glUniform3fvARB(glGetUniformLocationARB(brickProg, "BrickColor"), 2, fv);

the result is:
BrickColor[0] = 1.0, 0.3, 0.2
BrickColor[1] = 0.5, 0.4, 0.6
***myMat = 0.5, 0.4, 0.6,
4.0, 5.0, 6.0,
7.0, 8.0, 9.0
It seems that only 1 vec3 is allocated to the BrickColor array other than 2 vec3 while linking shader. So brickColor[1] and mat[0] share the memory, and the first column is writen by BrickColor[1] in this example.
Is this a bug?

How are you getting the uniform values back? (judging from the previous post you may be doing it incorrectly).

I test the value in shader, and then I know the value is error. But according to glsl reference, uniform array is permissible.

I have solved the problem after install the latest driver. My graphics card is NVidia6200, and the latest driver for it is 81.85, which is released today. Even 81.84 still contains bug.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.