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 5 of 5

Thread: World, camera, object coordinates in the glOrtho function

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2017
    Posts
    3

    World, camera, object coordinates in the glOrtho function

    I have a great confusion, when I have to use the glOrtho function, I do not know which system of coordinates it uses for its parameters, namely: left, right, bottom, up, close, do they are compared to what coordinate system? Would it be possible to have a figure that shows me clearly and unambiguously?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,123
    Eye space. If you get a decent OpenGL book, it'll describe this pretty clearly:

    * OpenGL Projection Matrix (Ahn)

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2017
    Posts
    3
    Quote Originally Posted by Dark Photon View Post
    Eye space. If you get a decent OpenGL book, it'll describe this pretty clearly:

    * OpenGL Projection Matrix (Ahn)
    Ok, but near and far in the glOrtho: these values are negative if the plane is to be behind the viewer. Is the viewer the camera or the object ?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	perspective-transform-visual-diagram-opengl-3d-to-2d.jpg 
Views:	11 
Size:	9.2 KB 
ID:	2464  

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,123
    Quote Originally Posted by giorgik View Post
    Ok, but near and far in the glOrtho: these values are negative if the plane is to be behind the viewer.
    Correct. So near/far are actually the negation of eye-space Z axis values.

    Is the viewer the camera or the object ?
    The camera.

    To your original question, the glOrtho parameter values are specified in eye-space. In eye-space, the camera (the viewer) is at the origin looking down the -Z axis with +X right and +Y up.

    So as for the glOrtho parameters...:

    • left and right are eye-space X axis values
    • bottom and top are eye-space Y axis values
    • near and far are eye-space Z axis values, but negated!


    So for instance, glOrtho with a near argument of 1.0 equates to the Z = -1.0 plane in eye-space, which is in front of the eye (the origin).

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2017
    Posts
    3

    Quote Originally Posted by Dark Photon View Post
    Correct. So near/far are actually the negation of eye-space Z axis values.



    The camera.

    To your original question, the glOrtho parameter values are specified in eye-space. In eye-space, the camera (the viewer) is at the origin looking down the -Z axis with +X right and +Y up.

    So as for the glOrtho parameters...:

    • left and right are eye-space X axis values
    • bottom and top are eye-space Y axis values
    • near and far are eye-space Z axis values, but negated!


    So for instance, glOrtho with a near argument of 1.0 equates to the Z = -1.0 plane in eye-space, which is in front of the eye (the origin).
    Oh, it's finally clear now. So close values and positive results in GlOrtho are actually negative on z axis.
    Thank you, Dark Photon

Posting Permissions

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