PDA

View Full Version : gluLookAt



Pops
03-03-2003, 05:39 PM
I am currently using the following method to position my "camera"

(I know that rotation x y z is not strictly correct but eaiser that pitch roll yaw)

glTranslated(pos_x, pos_y, pos_z)
glRotated(rot_x, 1.0, 0.0, 0.0)
glRotated(rot_y, 0.0, 1.0, 0.0)
glRotated(rot_z, 0.0, 0.0, 1.0)
(I might have rotated first, I cant remember)

this works fine for me, but should I be using gluLookAt insted. Dose it do the same thing to the matrix (I make my translations and rotations to the modelview matrix before I start drawing and positioning my objects)

Thanks

shinpaughp
03-03-2003, 09:05 PM
Either can be used. Depends on your purpose, in my opinion. Also, which is easier for you to calculate. If what you showed works, then no reason to switch. But, yes, both will change the current matrix.

If you do decide on gluLookAt, make sure that the eye and center coordinates ar never equal (same point) and that the vector formed by those 2 points are never parallel to the up vector.

Pops
03-04-2003, 05:09 PM
Thanks.

I'll continue using my method to save making new calculations (work out what I want to look at based on my rotation data) but I will probably use LookAt when I do my chase cam stuff.