Erakis

02-25-2002, 03:16 PM

Hello... http://www.opengl.org/discussion_boards/ubb/smile.gif

Well, 1 weeks ago, I dicided to build a Camara CLASS.

This one use it own matrix. So when the camera is Created :

MatCam = Matrix(Identity);

Each frame of my OpenGL program, the camera is refreshed.

Here, is what I do in the refresh function :

// Get the new orientation of the camera depend the degres

// here( DegPitch, DegRoll, DegYaw)...

CamOrientation = AngleEULERToQuat( DegPitch, DegRoll, DegYaw );

QuatNormalize( CamOrientation );

// Just after this, I set up a new matrix to contain the rotation.

MatRotation = MatIdentity;

MatTemp = QuatToMatrix( CamOrientation );

MatRotation = MatMultiply( MatRotation, MatTemp );

// I set up a new matrix again, but now to contain the translation.

MatTranslate = MatIdentite;

MatTranslate[12] = MatTranslate[12] - CamPos.vX;

MatTranslate[13] = MatTranslate[13] - CamPos.vY;

MatTranslate[14] = MatTranslate[14] + CamPos.vZ;

// To finalize, I load the rotation matrix and I multiply it by the

// translation matrix.

glMatrixMode(GL_MODELVIEW);

glLoadMatrixf( MatRotation );

glMultMatrixf( MatDeplacement );

// End of the refresh function....

************************************************** ********************

When I translate my camera, it's sound great.

But when I rotate it (any degres...) I got a weird rotation.

Ex : Under 90° (Y axis), my camera move backward and rotate too...

************************************************** ********************

What's could be the problem ?

Thanks to help me...

PS :Here is my matrix format :

ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

[ 0 4 8 12 ]

[ 1 5 9 13 ]

[ 2 6 10 14 ]

[ 3 7 11 15 ]

eraquila@bigfoot.com

[This message has been edited by Erakis (edited 02-25-2002).]

[This message has been edited by Erakis (edited 02-25-2002).]

[This message has been edited by Erakis (edited 02-25-2002).]

Well, 1 weeks ago, I dicided to build a Camara CLASS.

This one use it own matrix. So when the camera is Created :

MatCam = Matrix(Identity);

Each frame of my OpenGL program, the camera is refreshed.

Here, is what I do in the refresh function :

// Get the new orientation of the camera depend the degres

// here( DegPitch, DegRoll, DegYaw)...

CamOrientation = AngleEULERToQuat( DegPitch, DegRoll, DegYaw );

QuatNormalize( CamOrientation );

// Just after this, I set up a new matrix to contain the rotation.

MatRotation = MatIdentity;

MatTemp = QuatToMatrix( CamOrientation );

MatRotation = MatMultiply( MatRotation, MatTemp );

// I set up a new matrix again, but now to contain the translation.

MatTranslate = MatIdentite;

MatTranslate[12] = MatTranslate[12] - CamPos.vX;

MatTranslate[13] = MatTranslate[13] - CamPos.vY;

MatTranslate[14] = MatTranslate[14] + CamPos.vZ;

// To finalize, I load the rotation matrix and I multiply it by the

// translation matrix.

glMatrixMode(GL_MODELVIEW);

glLoadMatrixf( MatRotation );

glMultMatrixf( MatDeplacement );

// End of the refresh function....

************************************************** ********************

When I translate my camera, it's sound great.

But when I rotate it (any degres...) I got a weird rotation.

Ex : Under 90° (Y axis), my camera move backward and rotate too...

************************************************** ********************

What's could be the problem ?

Thanks to help me...

PS :Here is my matrix format :

ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

[ 0 4 8 12 ]

[ 1 5 9 13 ]

[ 2 6 10 14 ]

[ 3 7 11 15 ]

eraquila@bigfoot.com

[This message has been edited by Erakis (edited 02-25-2002).]

[This message has been edited by Erakis (edited 02-25-2002).]

[This message has been edited by Erakis (edited 02-25-2002).]