Jump to content
  • Advertisement
Sign in to follow this  
Cacks

gluLookAt up value

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

hi guys, when using gluLookAt(...) the last 3 values indicate the up value. Does this up value always point towards the sky? or if rotate my camera to look down, a new up value has to be created? Thanks for any help given!

Share this post


Link to post
Share on other sites
Advertisement
it depends if you want roll to your camera. If you do want your camera to be able to roll, you will need to change the up vector at each camera move. However, this is almost never the case in video games (besides from maybe flight simulators). In general, I keep the up vector at a constant (x,y,z) = (0,1,0) where the y axis is what I consider 'up'.

So, in short, to answer your two questions in general: yes, no.

Hope that helps. Does that clarify?

Share this post


Link to post
Share on other sites
The up vector is relative to the camera. So yes, if you want the camera to look up or down, you will need to specify a tilting up vector. I just use two glRotate calls to set my camera's orientation. I think its easier this way:
glRotatef(pitch,1,0,0);
glRotatef( yaw,0,1,0);
glTranslatef(x,y,z);

Share this post


Link to post
Share on other sites
Quote:
Original post by avocados
The up vector is relative to the camera. So yes, if you want the camera to look up or down, you will need to specify a tilting up vector.


There is absolutely no need for that, as long as the "up" vector is at least pointing into the right half space. gluLookAt will do a bunch of cross products and normalize the vectors to "fix" it, anyway. But it prevents the camera from ever being upside down and you can only look "almost" straight up or down. For a completely "free" camera I'd either use a matrix or quaternion+vector and not use gluLookAt at all.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!