I have been using gluLookAt in my test 3D engine and have devised a spherical coordinate calculation to supply the reference point to the function. My tilt angle goes from 0 to 180 degrees and I noticed that when I was close to those natural extremes, my objects jerked a little. I then set my calculation to keep me 5 degrees away from 0 and 180 but the jerk still remained. I took a look at the gl… calls that make up gluLookAt and noticed that there is a cross product of the UP vector and the vector created by the line of sight. Obviously, when these are close to being parallel, there will be problems. Any ideas on how to improve the performance of gluLookAt at the extreme tilt angles? Maybe make my own function…?
Correct me if I’m wrong, but shouldn’t the line-of-sight (direction)and the up vector (rotation around direction vector) always form a 90 degree angle (don’t know the english word for it, sorry. I’m from Sweden
Yupp, you are right Lord Chaos. The angle between line-of-sight and the upvector should always be 90 degrees.
The upvector can be a bit hard to understand, but to make it (very) short, it’s pointing upwards relative to the camera, not to the world itself.
If your cameras orientation is determined by pitch and yaw angles (quake-style) then you will be better off setting it up with 2 glRotate calls - one around the x axis, one around the up axis.