View Full Version : Camera Roatation

11-24-2004, 09:56 AM

Im using OpenGl(obviously) GLUT, programming in C and using visual studio 6.

Basically i have 2 objects on the screen. One is a stationary 3d dartboard and one is a 3d arrow. The arrow moves towards the dartboard using gltranslatef and eventually hits the dartboard. What i want to do is move the camera in a full circle constantly around my scene. So the camera kind of orbits my scene. Any idea how to do this? Ive looked at gluLookAt but i cant figure out which parameters i need to change, and ive tried all of them with no success. Thanks for any help :-)

11-24-2004, 10:10 AM

You're talking about tumbling the camera, and in OGL, the easiest way to do that is to just rotate the whole scene:

void display( void )
glMatrixMode( GL_MODELVIEW );
glPushMatrix(); //for whole scene
glRotatef( frame * rotAmount, 0, 1, 0 );
...draw the scene here
}frame is current frame and rotAmount is the number of degrees to tumble each frame.

Hope it helps,