Frequently asked questions are a bit outdated. Technically, with OpenGL-3, you can transfer matrices in row order format by setting the transpose parameter glUniformMatrix to true.
However, I personally find that the main column orders a huge advantage: it allows you to directly access the base vectors of the coordinate system (transformation) that the matrix describes. Look at your typical transformation matrix.
X_x Y_x Z_x T_x X_y Y_y Z_y T_y X_z Y_z Z_z T_z W_a W_b W_c W_w
X, Y and Z are the base vectors of the coordinate system you are transforming into, T is the offset.
Now look at the indexing used by OpenGL
0 4 8 c 1 5 9 d 2 6 ae 3 7 bf
So, at offset 0 you find the vector X, at offset 4 you find Y, offset 8 gives Z, and offset c gives T. You can access them directly, pass them to vector manipulation functions, such as
float vec4_length3(float v[4]);
straight:
float M[16] = {...}; float T_length = vec4_length3(&M[c]);
instead of first abandoning these vectors from the matrix in parts.
source share