PDA

View Full Version : Translate and Rotate the camera?



RobertSI
05-04-2000, 07:53 PM
I'm following the procedures from the RedBook
and the SuperBible for the order of transformations. I would like to know at what
transformation can the camera be manipulated with the keyboard?
I thought maybe the modelview transform,but
the camera was set with gluLookAt and the viewport was defined with gluPerspective.
What function is left to manipulate the camera?

Gorg
05-06-2000, 08:45 AM
Use the modelView matrix, it is more simple to know what will happen then. With the Projection Matrix, it's kind of messy.


There is actually no camera. Objects are moved from a reference point(usually 0).

The camera is just a way to simplify the concept.

when you say glTranslate(-1.0,0.0,-2.0)

you are moving the objects -1.0 on the x axis from the reference point or the camera and -2.0 on the z axis from the reference point.

glulookat simply encapsulate gltranslate and glrotate function.

There is one catch with the camera. If you say you want to move the camera two units up on the Y-axis, you must not use
glTranslate(0.0,2.0,0.0), because like I told you glTranslate move the vertices from a reference point. You must use

glTranslate(0.0,-2.0,0.0).

this exactly what glulookat do, when you specify a position of 0.0,2.0,0.0, it calls

glTranslate(0.0,-2.0,0.0). It inverts the signs to simulate a "movement", but it is actually the objects that moved.

abhijeet_maharana
07-13-2003, 07:28 PM
When U call glTranslatef, I think the models are moved with respect to the origin of the coordinate system. Gorg, could u please throw some more light on this topic?

Thanx.

[This message has been edited by abhijeet_maharana (edited 07-13-2003).]