Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: gluLookAt PROBLEM!

  1. #1

    gluLookAt PROBLEM!

    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.

  2. #2
    Intern Contributor
    Join Date
    Mar 2000
    PA, USA

    Re: gluLookAt PROBLEM!

    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.

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000

    Re: gluLookAt PROBLEM!

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts