#### Archived

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

# How does gluLookAt work?? ( specifically )

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

## Recommended Posts

Hey guys, I can''t remember how gluLookAt works. It''s something like: gluLookAt(current x,y,z, LookAt x,y,z, ???? x,y,z) I usually just use glLoadIdentity(), but I''m pretty sure that I can do lots more with my current game if I start utilising gluLookAt. Can someone please answer the following questions. 1) What is the ???? mentioned above? ( do I have the rest right? ) 2) How would I use gluLookAt in the first person perspective? ( for example, what would I do with gluLookAt when I move the mouse right ( and rotate the world left ))? 3) Is it really beneficial to use gluLookAt instead of glLoadIdentity()? Or should I just stick with what I''m using now? Ideally I''d like to learn how to use gluLookAt anyway, just so that I know it, and it''ll never stump me in the future.. I really really hope some of you more experienced gl-programmers can help me out with this. Thanx. ~Cobra~

##### Share on other sites
LOL, well it took all of about 3 minutes to get gluLookAt to give me the same result as using glLoadIdentity();

I''ve managed to answer question 2 so far, but if you guys could answer 1 and 3 it''d be much appreciated.

~Cobra~

##### Share on other sites
Hmm.. Correct me if I''m wrong but I thought that glLoadIdentity was just for reseting a matrix??

Anyway, the ??? is the up vector. Typically, you''ll set the values to something like (0.0, 1.0, 0.0). In this case, the vector is parallel (sp?) to the y axis, with up going to the positive y and down going to the negative.

gluLookAt, if I''m not mistaken, just performs some operations (translate, rotate, etc). So if you''re asking if it is better to use gluLookAt() rather than glTranslatef(), glRotatef() etc, I''d say it''s just a matter of taste. I personnally find it easier to work with gluLookAt(), but that''s up to you.

I hope this makes sense. If it doesn''t I''m sorry, I''m having a hard time keeping my eyes open and I lack english vocabulary.

##### Share on other sites
see www.mesa3d.org for source code of what gluLookAt does

http://members.xoom.com/myBollux

1. 1
Rutin
69
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633421
• Total Posts
3011797
• ### Who's Online (See full list)

There are no registered users currently online

×