Construct a uniform 3x3 Matrix

I have this 3x3 rotation matrix created in the main code that I want to send to the the vertex shader using glGetUniformLocationARB and glUniformMatrix3fvARB and the inparameters of the glUniformMatrix3fvARB are the uniform location variable, count variable, transpose variable and the array which is supposed to represent the whole matrix.

And I am not sure how to assign the values from the rotation matrix to the array at the right way. If the matrix has the size 3x3 then the length of the array should be at 9.

If the matrix has the values:

|1 2 3|
|4 5 6|
|7 8 9|

Should the array be assigned at this way:

{1 2 3 4 5 6 7 8 9} ?

if (transpose == GL_TRUE)
array should be 1 2 3 4 5 6 7 8 9 (row major)
else
array should be 1 4 7 2 5 8 3 6 9 (column major)

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