PDA

View Full Version : moving camera



mikemor
09-30-2002, 09:45 AM
I have a scene with a few lights and I want to move the camera: I want to translate about the axes and to rotate the camera about the look at vector.
To implement translations of the camera do I just do
a gltranslate? How to do the rotation about the look at vector? Do I need to push and pop? (I want to move the lights with the camera)

Thanks

nexusone
09-30-2002, 10:53 AM
There are a few way that you can simulate camera movement with openGL.

One is to use glTranslate/rotate, without and glPush/pop. Then everything after is drawn using glPush/pop.

nehe.gamedev.net has a tutor on camera movement.



Originally posted by mikemor:
I have a scene with a few lights and I want to move the camera: I want to translate about the axes and to rotate the camera about the look at vector.
To implement translations of the camera do I just do
a gltranslate? How to do the rotation about the look at vector? Do I need to push and pop? (I want to move the lights with the camera)

Thanks

mikemor
09-30-2002, 12:35 PM
Thanks. What if I want to use glulookat and avoid using glrotate. How to implement rotations about look at vector using glulookat?

cwc36
09-30-2002, 03:44 PM
glutLookAt(eye_x,eye_y,eye_z,obj_x,obj_y,obj_z,up_ x,up_y,up_z)

eye_x,eye_y,eye_z = coordinates of your eye.
obj_x,obj_y,obj_z = where u look at.
up_x,up_y,up_z = which direction is up. Normally the Up value is 0,1,0. It's meants that the camera always look infront.

u can refer to red book for more detail.(page 119).