PDA

View Full Version : Moving eyepoint in direction of viewing angles



02-02-2002, 11:57 AM
Hi,

I'm trying to write an interface to allow the user to fly around in a model. My interface uses the mouse for freelook by modifying phi and theta, and that's working fine. But then I want to be able to move forward in the direction of view (or directions perpendicular) using the arrow keys, but I'm having trouble with the code that moves the eyepoint.

My rendering code uses the following transform:
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(theta, 1.0, 0.0, 0.0);
glRotatef(phi, 0.0, 1.0, 0.0);
glRotatef(90.0, 1.0, 0.0, 0.0);
glTranslatef(eyepoint[0],eyepoint[1],eyepoint[2]);

Does anyone have any sample code or advice for how I can move the eyepoint some distance in the direction of phi and theta?

Thanks!