Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Small axes in corner with gluLookAt + gluPerspective

  1. #1
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    2

    Small axes in corner with gluLookAt + gluPerspective

    Hi,

    I have a problem that I'm unable to resolve.

    I'm trying to draw small XYZ axes in the corner like a lot of programs. The problem is that all the codes I produce or all the codes I find on the web draw the axes like in an Ortho view (such as here and here).

    Indeed, the vertical axis (Z in my case) is always vertical, even when it is not in my perspective view.

    Here is an exemple :

    Thanks,

    Benjamin

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,098
    The easiest is to set a small viewport ( like 0,0,50,50) and render the axes as unit lines with a camera with eye = normalise(current_camera_lookat - current_camera_eye) * 4, lookat = 0,0,0, up = 0,1,0. You may need to adjust how far the the new eye point
    is from the origin (thats what the * 4 does)

  3. #3
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    2
    Quote Originally Posted by tonyo_au View Post
    The easiest is to set a small viewport ( like 0,0,50,50) and render the axes as unit lines with a camera with eye = normalise(current_camera_lookat - current_camera_eye) * 4, lookat = 0,0,0, up = 0,1,0. You may need to adjust how far the the new eye point
    is from the origin (thats what the * 4 does)
    Actually, it's what I'm doing now. It's more curiosity than another thing since the axes are in reality the same as the small axes. But I never found a solution to this question.

    Thanks for your answer.

    Benjamin

  4. #4
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    164
    Not sure what you're asking. Most people would be satisfied with what you have in the image you posted.
    How do you want the little triad to look in that image?
    Do you want the blue axis to be tilted at the same angle as the blue line coming out of the top of the pyramid?
    If you translate the pyramid to the left side of the screen the blue line would be tilted the other way.
    Would you want the little corner triad to tilt the other way too?
    Most people don't want this because it does not reflect the true orientation of the main coordinate system.
    The blue line coming out of the top of the pyramid is tilted because it's been translated away from the origin.
    AND - because it's perspective projection. If you translate the pyramid to the center of the FOV of the camera,
    the lines coming out of the pyramid will be parallel to the little triad in the corner.
    Usually people want a small, corner triad, to show the orientation of things in the center of the FOV.
    If you can explain clearly what you'd like to see, people will make suggestions.
    But they may not be as trivial as you hoped.

Posting Permissions

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