PDA

View Full Version : gluLookAt translate in y direction

ulric
02-14-2004, 09:22 AM
Hi,

according to Nate Robins Tutorial transformation I wanted to raise up the viewpoint along the y axis.

Beginning at gluLookAt(0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) I wanted to raise the "camera" along the y-axis. It should look like a view out of an elevator. The next step was gluLookAt( 0.0, 0.6, 2.0, 0.0, 0.6, 0.0, 0.0, 1.0, 0.0). But I was astonished that the line between the "camera" (0.0, 0.6, 2.0) and the aim (0.0, 0.6, 0.0) wasn't parallel to the z-axis.
The "camera" was looking down to the aim.
Can anybody explain me why or what I have done wrong.

Ulric

mikael_aronsson
02-15-2004, 05:13 AM
You are not doing anything wrong. If you are looking "down" with your gluLookAt then it cannot be parallel to the Z axis. If you wanted it to be along the Z axis you should have set both Y coordinates the same value.

Mikael

ulric
02-15-2004, 05:36 AM
Hi Michael,

>[QUOTE]Originally posted by >mikael_aronsson:
>[B]You are not doing anything wrong. If >you are looking "down" with your gluLookAt >then it cannot be parallel to the Z axis. >If you wanted it to be along the Z axis >you should have set both Y coordinates the >same value.

The next step was gluLookAt( 0.0, 0.6, 2.0, 0.0, 0.6, 0.0, 0.0, 1.0, 0.0).

As far as I know the first param trible of gluLookAt consits of the x, y, z coord. of eye, the second of the x, y, z coord. of the aim and the third is the up vector. If
I don't have a problem with my eyes or a problem with number, the y coord. of eye and aim is both 0.6.

Therefore I'm so astonished
Ulric
the second

mikael_aronsson
02-15-2004, 12:26 PM
Hi !

Ok, sorry, got it wrong there, make sure you are messing with the correct matrix, if you apply gluLookAt to the projection matrix for example you can get weird behavior.

Mikael