I’m creating a camera engine that’s it own matrix. So If I want to move the camera Up and Down I will do that :
MatCamera[13] = MatCamera[13] - Movement;
Also, if I want to move to forward and backward :
MatCamera[12] = MatCamera[12] - Movement * CamLook.X;
MatCamera[14] = MatCamera[14] - Movement * CamLook.Z;
…
To update the camera :
glMatrixMode(GL_MODELVIEW); glLoadMatrixf( MatCamera );
But now I got some problem when I need to rotate the camera. In other word, I need to modify some value into the MatCamera matrix to realize a rotation around an axis.
I know that Quaternion could be the best utility to proceed but HOW to use it ?
How can I extract the present X rotation inside the MatCamera matrix to modify it or increment it ? After this, I believe that I need to convert it to a Quaternion and an axis ? How can add this rotation to my MatCamera matrix ?
Thanks to help me…
I’m desperate…
PS :I just want to know if it’s the right way to get the UP vector of the ModelView matrix
UpVect.X = MatCamera[1]; UpVect.Y = MatCamera[5]; UpVect.Z = MatCamera[9];
Concept of OpenGL matrix & my camera matrix :
[ 0 4 8 12 ]
[ 1 5 9 13 ]
[ 2 6 10 14 ]
[ 3 7 11 15 ]