Jump to content
  • Advertisement

Archived

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

Cobra

How does gluLookAt work?? ( specifically )

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

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 this post


Link to post
Share on other sites
Advertisement
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.


Thanx in advance.

~Cobra~

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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 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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!