ioquan

04-21-2002, 09:05 PM

I have just switched my method of storing orientations from euler angles to a right vector, up vector, and forward vector (any one of them can actually be computed by taking the cross product of the other two, but I store all three anyway). The idea is that these three vectors make up the object or camera's local axes.

I have a matrix class which can operate on my point or vector class. It can make roll,pitch and yaw matrices, and also matrices from quaternions.

All of my world updates (objects moving around) are done independent of the gl matrices. The gl matrices are used for doing the view transformation and transformations of objects from local to world coordinates.

When I update my world, I add the velocity to the position, and rotate the object or camera's orientation vectors by a rotation velocity (again, this is done without the gl matrices). I have verified that my orientation vectors are being rotated properly by using GL_LINES to draw them. (note, when verifying this, I comment out all calls to glRotate. The orientation vectors are rotated without gl matrices, then they SHOULD be used to make a call to glRotate to rotate all vertices when drawing)

The problem is, now that I have the up vector, right vector, and forward vector, I dont know how to call glRotate to rotate the object or camera. I have tried many different methods (remember, i started out with euler angles). I imagine doing this is pretty similar to what gluLookAt does. I dont want to use gluLookAt though, and I'm not sure if that would work for rotating objects as well as cameras. So, can someone offer some help with how to call glRotate to work with the up, right, and forward vectors that I have? (note: only two of the vectors should be needed for the view transformation: the other is needed to ensure proper rotations based on velocities during the world update)

I have a matrix class which can operate on my point or vector class. It can make roll,pitch and yaw matrices, and also matrices from quaternions.

All of my world updates (objects moving around) are done independent of the gl matrices. The gl matrices are used for doing the view transformation and transformations of objects from local to world coordinates.

When I update my world, I add the velocity to the position, and rotate the object or camera's orientation vectors by a rotation velocity (again, this is done without the gl matrices). I have verified that my orientation vectors are being rotated properly by using GL_LINES to draw them. (note, when verifying this, I comment out all calls to glRotate. The orientation vectors are rotated without gl matrices, then they SHOULD be used to make a call to glRotate to rotate all vertices when drawing)

The problem is, now that I have the up vector, right vector, and forward vector, I dont know how to call glRotate to rotate the object or camera. I have tried many different methods (remember, i started out with euler angles). I imagine doing this is pretty similar to what gluLookAt does. I dont want to use gluLookAt though, and I'm not sure if that would work for rotating objects as well as cameras. So, can someone offer some help with how to call glRotate to work with the up, right, and forward vectors that I have? (note: only two of the vectors should be needed for the view transformation: the other is needed to ensure proper rotations based on velocities during the world update)