glGetUniformLocationARB and mat3

Hi,

I declared a mat3 variable as uniform, and I am trying to specify its value from the app. But whatever I try is failing. I tried to get a GLSL “pointer” (via glGetUniformLocationARB) for each of its component, i.e. glGetUniformLocationARB(program, “MyMat3[0][0]”), or for each of its rows “glGetUniformLocationARB(program, “MyMat3[0]”)”, or even directly for the whole matrix, but everything is failing. I can successfully access variables such as vec3, structure, and everything, but mat3 not to avail. Are there specific issues with matrix variables?

Dietmar

PS: Win32, nVidia 6600 (77.72 driver)

PPS: Are newer nVidia drivers (81.xx) better/worse than older (77.xx) for OpenGL 2.0 support? Any new problems?

Use glGetUniformLocationARB (handle, “MyMat”) to get its location. Then use glUniformMatrix3fvARB (location, 1, GL_FALSE, value) where location is the result of the previous call (glGetUniformLocation) and value is a point to the 9 value array of your matrix.

or for each of its rows “glGetUniformLocationARB(program, “MyMat3[0]”)”
Be aware that the OpenGL default for matrices is column-major! MyMat3[0] is a column inside a GLSL shader source. Notice the transpose parameter in glUniformMatrix3fvARB().

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