# 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.

## 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 on other sites
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 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 on other sites
Quote:
 Original post by avocadosThe 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.

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 12
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633314
• Total Posts
3011327
• ### Who's Online (See full list)

There are no registered users currently online

×