I’m building a camera Class. There, is the private members of the class :

//Camera matrix
MATRIX4 CamMatrix;

// Each axis of the camera
VECTOR3D CamAxisX;
VECTOR3D CamAxisY
VECTOR3D CamAxisZ

// Direction vector
VECTOR3D CamView;

//Position of the camera
VECTTOR3D CamPos

So now I will explain what is my problem.
I want to use my own matrix operation, so I don’t want to use glRotated or glTranslated.
I just need to use a GL command when it time to update the camera so
glLoadMatrix( CamMatrix )

Well, now I have no difficulty with translation along an axis. So I can go UP and DOWN, Straf LEFT to RIGHT or move FORWARD and BACKWARD.

The problem is starting with rotation
I built a function like this one :

Camera::Pitch( float Angle )
{
// Where Angle could be 15°. So add 15°
// to the camera direction (Ex :Look Up)
// I have/want to update the matrix and the
// others members of the class.
// If axis change I need to update it too.
// I know that I need to apply a rotation
// (pitch) around the X axis but how ?
// What I need ? Help please
}

A big Thanks
Martin

[This message has been edited by Erakis (edited 06-10-2002).]

If you are going to use glLoadMatrix you might as well store your camera orientation in a matrix ( MATRIX4 CamMatrix) and get rid of those VECTOR3D. A 4x4 matrix is composed of the rotation parts and the position so there is no point storing the info twice.

If your Matrix4 class is any good it will have all the rotation functions you need otherwise find a class that does have them.

It’s relatively easy to create a rotation matrix to rotate around the X, Y, and Z axes – it should be in any graphics book or any basic info on transformations. Just remember that order is important and you may have to transpose the matrices to account for using a different order.

Well, Something is missing or I’m on the right way ?

On each frame, I update the matrix if it’s nessary, with this function :

Camera::UpdateCameraMatrix()
{
// I think I need to mult those matrix ?
// Which order is the best ?
// Translation * RotationMatrix_X *
// RotationMatrix_Y * RotationMatrix_Z;
}

A BIG Thanks again.
Martin.

[This message has been edited by Erakis (edited 06-10-2002).]