getting a matrix

How can I get a matrix from opengl and store it in an array like float m[16]?

I know I could use matrix pushing and popping but it would be more handy to store the into an array and load later on.

float array[16];
glGetFloatv(GL_MODELVIEW_MATRIX, array);

float matrix [16];

glGetFloatfv (GL_MODELVIEW_MATRIX, matrix);

and remember that opengl stores matrix in a column-dominant order, that is :

0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15

–Morglum

oops, we posted exactly at the same time, Deiussum !

Thanks.

You can also use the extension GL_ARB_transpose_matrix if you have matrix in math format (line, row)

Arath