Possible Duplicate:
What exactly is the UP vector in OpenGL's LookAt function?
This is related to: What exactly is the UP vector in OpenGL's LookAt function?
If the call is:
gluLookAt(512, 384, 2000,
512, 384, 0,
0.0f, 1.0f, 0.0f);
If I am sitting on a chair looking straight ahead, holding an iPad right in front of my eyes, then my top of my head is pointing up the sky. Therefore the (0, 1, 0)
for the UP vector, as on the 3rd row. How about if I change it to (0, 0.00001, 1)
? That means I am almost lying down, with now my face and eyes facing the sky. So how come the result is exactly the same as when I use (0, 1, 0)
?
After more trial and error, as I just started learning OpenGL for one day, is that, the Up vector must have some components in the plane that is "normal" (or perpendicular) to the camera to target vector.
In other words, in the example, it is from (512, 384, 2000) to (512, 384, 0), so the vector is only in the Z-direction. The Up vector must have some components on the XY plane (XY plane is the one that is perpendicular to the vector that has only the Z direction).
If there is no x and no y component, that is, if they are both 0, then on my iPad 2, the image is not displayed at all. So the Up vector deals with rotation in the XY plane in this case, and not case about the Z direction at all.