PDA

View Full Version : glGetUniformLocationARB and mat3



nurbz
11-27-2005, 06:19 AM
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?

jide
11-27-2005, 11:39 AM
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.

Relic
11-27-2005, 11:07 PM
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().