PDA

View Full Version : combining gluLookAt and object transformations



12-03-2002, 07:36 AM
Hi... http://www.opengl.org/discussion_boards/ubb/smile.gif
I'm trying to write a simple application that allows one to place an object in the 3D space (by specifying translation/rotation coordinates), and to view the scene from any point in the space (by specifying eye coordinates and sight direction). I'm using gluLookAt(), as I have seen in many guides and tutorials.
But something doesn't work well. If I call

glLookAt(1.0, 0.0, -5.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0);

and then

glTranslatef(1.0, 0.0, 0.0);

I think I should see the object in the center of my viewpoint (because it is in 1,0,0; my eye is in 1,0,-5, and looks at 1,0,0). But this doesn't happen: I see my object slightly shifted on the right.
Could anyone help me?

Thanks!!! http://www.opengl.org/discussion_boards/ubb/smile.gif

bakery2k
12-03-2002, 12:06 PM
It should work.
Is your object modelled around the origin (of object space)?

ae97004
12-03-2002, 08:23 PM
See if you using glOrtho or glPerspective they both work differently, first try with ortho then negate the Z and use it for glPerspective that should work

ae97004