glGetUniformfv and matrices

Hello,

I am having trouble using glGetUniformfv to query the initial value of a uniform matrix. The shader looks like:

#version 120
uniform mat2 m2 = mat2(0.1, 0.2, 0.3, 0.4);
// ...

After the shader compiles and links with no errors or warnings, I query the initial value of m2 with glGetUniformfv:

float v[4];
glGetUniformfv(programHandle, index, v);

And I wind up with

v[0] = 0.10000000
v[1] = 0.20000000
v[2] = -0.0013270393
v[3] = -0.0013270393

The second column of the matrix is incorrect.

The funny thing is after I modify the uniform with glUniformMatrix2fvARB, glGetUniformfv starts to return the correct value.

Am I doing something wrong? Or is this potentially a driver bug? I have a GeForce 8800 GTX with up to date drivers as of last week. I’ve also tried with mat3 and mat4.

Thanks,
Patrick

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