How does the gluLookAt work?
I have a object that I want to look at from different angles, starting looking from above. The eye rotates smooth around the airplane if I only increase the value for one axis at the time. But in combinations and if I try to increase the z-value,then it won’t work as I think it should.
And when I increase the value for x or y then I have to have z=1 for it to work.
Be careful using gluLookAt. The eye and focus points are easy enough to get, but the
up vector is what can cause problems. If you take the vector from the eye to the focus point, the up vector should not be in the same or opposite direction. The trouble comes when you adjust the eye and focus points, but not the y-vector. Your scene may turn upside down (or some variation of “not right-side up”, or disappear completely.
One way to avoid this problem is to use gluLookAt to initially setup your camera and use the other OGL matrix functions to apply transformations to the result of the gluLookAt function.
Hope this helps. Good luck.
Some more information about the up vector…
The angle between the line of sight and the up vector is always 90 degree. The upvector tell gluLookAt how the camera is rotated about it’s own line of sight, in other words, it’s a quite important thing.
By the way, thanks for that tip Ben, gotta try it out when I get home