Matrix in OpenGL

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

4x4 matrix in memory.

[R0 R3 R6 Tx]
[R1 R4 R7 Ty]
[R2 R5 R8 Tz]
[ 0 0 0 1]

‘R’ represents rotations and scaling (and shearing)
‘T’ translation

First, I read the matrix and print it.

float x[16];
int i;

//read the 4x4 matrix and store in x
glGetFloatv (GL_MODELVIEW_MATRIX, (float*)x);

//print the matrix
for(i=0; i


  1. I may need your help. I tried many ways but couldn’t solve it, but after reading your article, I think you have a way to help me. I’m looking forward for your reply. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *