Eric

02-28-2000, 10:23 PM

Hi there.

I am developping some kind of basic 3D modeller which imports various formats and exports to my own format for my own viewer (my format is quite OpenGL-oriented as you can imagine !).

I wanted to implement in the modeller the kind of rotation you have in 3D Studio Max.

Basically, the object will always rotate around the world axes........

But I am stuck on how to reproduce that !

I wanted to keep track of the X_Angle,Y_Angle,Z_Angle and then use the 3 different rotation matrices to obtain the full rotation matrix. Of course it does not work (OK, I should have thought about that before !).

Let me explain... I wanted to use three rotations around X,Y,Z. I had three matrices Rx,Ry,Rz and I thought Rx*Ry*Rz=R would be my final matrix.... The problem is that when I apply Ry, it applies to my world coordinates system transformed by Rz !

Does anyone know how I can rotate my object about any of the X,Y,Z of the WORLD coordinates system ????

Just some precision : at the moment, for each object, I have a GLfloat m_TransformMatrix[16] (loaded with glLoadMatrix when rendering) and I keep track of the m_XRotationAngle, m_YRotationAngle and m_ZRotationAngle......

I am not afraid of complicated maths so you can go !

I would prefer an algorithm on how to build the transformation matrix based on my 3 angles but if I must use Euler angles and/or quaternions, please tell me !

Hope someone can save my life http://www.opengl.org/discussion_boards/ubb/smile.gif !!!

Eric

I am developping some kind of basic 3D modeller which imports various formats and exports to my own format for my own viewer (my format is quite OpenGL-oriented as you can imagine !).

I wanted to implement in the modeller the kind of rotation you have in 3D Studio Max.

Basically, the object will always rotate around the world axes........

But I am stuck on how to reproduce that !

I wanted to keep track of the X_Angle,Y_Angle,Z_Angle and then use the 3 different rotation matrices to obtain the full rotation matrix. Of course it does not work (OK, I should have thought about that before !).

Let me explain... I wanted to use three rotations around X,Y,Z. I had three matrices Rx,Ry,Rz and I thought Rx*Ry*Rz=R would be my final matrix.... The problem is that when I apply Ry, it applies to my world coordinates system transformed by Rz !

Does anyone know how I can rotate my object about any of the X,Y,Z of the WORLD coordinates system ????

Just some precision : at the moment, for each object, I have a GLfloat m_TransformMatrix[16] (loaded with glLoadMatrix when rendering) and I keep track of the m_XRotationAngle, m_YRotationAngle and m_ZRotationAngle......

I am not afraid of complicated maths so you can go !

I would prefer an algorithm on how to build the transformation matrix based on my 3 angles but if I must use Euler angles and/or quaternions, please tell me !

Hope someone can save my life http://www.opengl.org/discussion_boards/ubb/smile.gif !!!

Eric