Advertisement

Question about gluLookAt()

Started by May 23, 2002 01:06 AM
2 comments, last by emilbbb 22 years, 9 months ago
I wonder what the up vector in gluLookAt() is?
The up vector is exactly that, the ''up'' vector... it is the direction of the top of the camera/viewpoint. You can change it to rotate the camera clockwise/anti-clockwise.

Like for roll in car driving games or in flight sims.

Henry
Advertisement
Simply :

gluLookAt(0,0,-5,0,0,0,0,1,0);

0,0,-5 ==> The position of your camera
0,0,0 ==> Where your camera''s looking
0,1,0 ==> A directionnal vector

========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
To specify any 3D coordinate system, you need 3 non parallel vectors to form a basis. Of course, you can actually do it with just two vectors, because you can get the 3rd vector by taking the cross product of the first two, which will give you a vector perpendicular to the plane spanned by the first two vectors. If you look at gluLookAt, you see that the eye and position points can be subtracted to form a forward vector, which is the direction you are looking. This is not enough information, because while this tells you what direction you are looking in, you could be spinning around or upside down or sideways and still have the same forward direction. This is why the up vector is needed. gluLookAt can then take the cross product of the up and forward vectors to get the right vector and construct a transformation matrix.

This topic is closed to new replies.

Advertisement