• Advertisement
Sign in to follow this  

LookAt Camera

This topic is 4327 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Basically, I would like to create a first person camera. I know the trigonometric formulas for the rotations, but I don't know on which components of the opengl LookAt function apply them. Besides I would like my camera to move in the right direction. How could I do these operations... cheers

Share this post


Link to post
Share on other sites
Advertisement
gluLookAt() does not employ trig at all.

You supply it nine parameters -- the (x,y,z) of the eye's location, the (x,y,z) of the eye's target, and the (x,y,z) of an "up" vector. The location represents the 3D point where the eye is located in world space; the target represents the location that the eye is "looking at." The last parameter is used as a temporary.

What gluLookAt() is use its parameters to build an orthonormal basis for view space and use that basis to compte a rotation matrix that it applies to the current matrix stack (usually the GL_MODELVIEW stack). The matrix will rotate and displace geometry in world space to eye space, so it appears "as the eye sees it."

Two good books covering these topics, and other related ones, are "The Geometry Toolbox," and "Essential Mathematics for Games and Interactive Applications." I strongly suggest that you purchase one or both if you can, because a solid grasp of these concepts is fundamental to 3D graphics programming.

Share this post


Link to post
Share on other sites
no, i can't...

i have to use the nine components of the following function :

gluLookAt(xp,yp,zp, xv, yv,zv, xu,yu,zu)

Share this post


Link to post
Share on other sites
Is *is* possible to move the camera using the glTranslate/glRotate et cetera functions appropriately as well. They modify the same matrix stack (if the stack is set correctly).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement