Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

GuessWhome

gluLookAt o_O confused

This topic is 5688 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

Ok I have to ask this... I have read everything possible to understand how it works but still confused... I will tell you what I have understood and you correct me please if I am wrong: eye : is a vector that represents the position of the camera. center: is a vector that is going out of the eye farward. up: is a vector that is heading upward from the eye.

Share this post


Link to post
Share on other sites
Advertisement
Well, that isn''t entirely correct.

eye is the eye.
center is a point that the eye is looking at. (not a vector).
up is a vector that is significantly different from the vector defined by the line connecting eye and center. It needn''t be perpendicular to that vector, but it needs to be different. By being different, a plane is defined by the two vectors.

That plane''s normal then defines left and right. Given the direction you are looking in and left and right, gluLookAt() can then compute exactly what that up vector is, since it would be the normal to the plane defined by the direction you are looking and left and right.

Share this post


Link to post
Share on other sites
First three terms : position of the camera (I'm sitting on my chair)
Second three terms : what the camera is looking at (my monitor)
Third three terms : the direction up (towards the roof)

I'm standing at 5,0,5, looking at 0,0,5, and up is 0,1,0.
This makes the camera look down the negative x-axis (0-5)

------------
MSN: nmaster42@hotmail.com, AIM: LockePick42, ICQ: 74128155
"It's all part of the conspiracy of conspirators conspiring to conspire their own conspiracies..."

[edited by - LockePick on January 24, 2003 2:23:16 AM]

Share this post


Link to post
Share on other sites
quote:

gluLookAt
NAME
gluLookAt -- define a viewing transformation
C SPECIFICATION
void gluLookAt(GLdouble eyex,
GLdouble eyey,
GLdouble eyez,
GLdouble centerx,
GLdouble centery,
GLdouble centerz,
GLdouble upx,
GLdouble upy,
GLdouble upz)

PARAMETERS
eyex, eyey, eyez
Specifies the position of the eye point.

centerx, centery, centerz
Specifies the position of the reference point.

upx, upy, upz
Specifies the direction of the up vector.
DESCRIPTION
gluLookAt creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an up vector. The matrix maps the reference point to the negative z axis and the eye point to the origin, so that, when a typical projection matrix is used, the center of the scene maps to the center of the viewport. Similarly, the direction described by the up vector projected onto the viewing plane is mapped to the positive y axis so that it points upward in the viewport. The up vector must not be parallel to the line of sight from the eye to the reference point.
The matrix generated by gluLookAt postmultiplies the current matrix.

SEE ALSO
glFrustum, gluPerspective


--------------------------------------------------------------------------------

back to the OpenGL index page



--------------------------------------------------------------------------------

© 1995 Uwe Behrens All rights reserved



all on this page:
http://www.cevis.uni-bremen.de/~uwe/opengl/gluLookAt.html

all found by going onto www.google.com and clicking on the first result of the search "gluLookAt"

listen to Uwe Behrens. he posted this into the web for you.

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
well, I have read that already.
it says :
quote:
centerx, centery, centerz
Specifies the position of the reference point.

and that does not make me very happy

as for the center, should I move it when I move the eye? or is it a value defined by the new eye location?

[I am at school at the moment so cannot post code]

Share this post


Link to post
Share on other sites
Aaaa, of course (i wrote it at 5:30 am ).

Center.x,center.y,center.z is position in space that you are looking at.


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ah thanks...

so I stand in 1,1,1 that means my eye vector is (1,1,1)
looking at 0,0,0 that means my center vector is (-1,-1,-1) right?
sorry if I am too stupid...

Share this post


Link to post
Share on other sites
No, center is not a vector. It's a position in space.
So when you stay somewhere in space and looking at 0,0,0 then
your centex vector is 0,0,0.

That's mean when your eye is in A and looking on B your center vector will be B, not B-A.

The eye and center vector is a position.
Only up vector is a vector (up direction).




[edited by - Cifko on January 24, 2003 12:28:35 PM]

Share this post


Link to post
Share on other sites
If you want to specify your look direction by an eye point and a look point, gluLookAt() provides that interface for you.

If you want to specify your look direction by an eye point and a vector, just create the vector defining the direction you are looking in, and then create the center by point by adding the look direction to the eye point like this:

E = eye.
D = direction vector (the direction we''re looking in)
C = center = E + D.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!