Public Group

# LookAt Camera

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

## 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 on other sites
can't you just move the camera with glTranslate3f() and glRotate3f()?

##### Share on other sites
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 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 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).

1. 1
2. 2
Rutin
22
3. 3
JoeJ
18
4. 4
5. 5

• 17
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631726
• Total Posts
3001910
×