View Full Version : Rotating the camers

01-08-2004, 12:44 AM

I want to know what How to rotate a whole scene using the camera in opengl
What I mean is moving the camera around the scene to see it from different direction ( left, right , front, back) using left/right arrows for example .

What is the concept or the idea to do that ?

Thanks to any help .

01-08-2004, 01:25 AM
OpenGL has no specific "camera".
The viewer is always in the eye coordinate origin (0,0,0).
Camera position and orientation manipulation is done with the modelview matrix.
Apply the desired camera manipulation inversely to the whole world. Like strafe left with the viewer is the same as translating the world to the right.
Mind the ordering of rotations! It's worth to look at quaternions for 6-degrees of freedom movement.
Be careful about the handedness of your camera implementation, cameras normally use a left handed system looking down the positive z-axis. But OpenGL model and world coordinate systems are right handed.

[This message has been edited by Relic (edited 01-08-2004).]

01-10-2004, 11:16 AM
Thanks Relic ..

01-11-2004, 08:02 AM
The Red Book (The OpenGL Programming Guide has a good intruduction to modelling and viewing transformations. An online version is available at http://www.parallab.uib.no/SGI_bookshelves/SGI_Developer/index.html
(That's the index, you'll also find the Reference Manual as well). Chapter three of the programming guide holds the introduction.