PDA

View Full Version : glRotatef and Matrix



stefkos
07-29-2012, 02:38 PM
Hey

I'm writing collada object loader but now I meet small problem. My object is a couple of nodes with position, rotation and scale described in matrix.

fe:
<matrix>1 0 0 123.6633836685638 0 1 0 -321.0477037719265 0 0 1 4.969635813978357e-014 0 0 0 1</matrix>

I've read this matrix and tryed to use it by multiply current matrix glMulMatrixf( mymatrix ); but my parts were not in correct places.
Then I used glTranslatef() and values from matrix m[ 3 ] as x, m[ 7 ] as y and m[ 11 ] as z and translation works ok. But now i have problems with rotation. I readed a lot of pages (about euler angles, quaterions, opengl, etc) and this forum to find solution but no success.
Can someone write some lines how to translate this matrix to rotation x,y,z (angle values for glRotatef() ).

Thx

stefkos
08-05-2012, 07:41 AM
Well, there is just need to load this matrix into float table, then transpose it and use glMultMatrixf().
Voaula! Solution:)