View Full Version : what when Up vector not orthogonal to Lookat?

07-20-2009, 03:46 AM
Hello everybody,

my question I think might be trivial but can't find an answer anywhere.
What happens if I have an upVector which is not orthogonal to the LookAt vector in the gluLookAt? Does opengl orthogonlize it somehow?

Many thanks

07-20-2009, 05:55 AM
Nothing. The up vector is only used to compute the camera X-axis. If it is not orthogonal to the view vector( Z-axis), the result would be a non-normalized vector, but for safety, the computed X-axis should always be normalized after its computation.

See this for more information about gluLookAt:

You may also take a look to the gluLookAt implementation is mesa3d code.

07-20-2009, 07:04 AM
Many thanks!