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

Thread: Conversion from gluPerspective to gluOrtho

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2014
    Posts
    5

    Conversion from gluPerspective to gluOrtho

    Hello all,

    I have this gluPerspective code :

    gluPerspective(45,width/height,10,40000);

    I want to use glOrtho version of this code. But I couldn't come up with the correct one. How can I convert this to glOrtho in a healthy way?

    Thanks in advance.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,463
    Quote Originally Posted by explorer101 View Post
    I want to use glOrtho version of this code. But I couldn't come up with the correct one.
    There is no "correct" one.

    A perspective projection results in objects appearing smaller as they get farther from the viewpoint. An orthographic projection maintains a constant scaling regardless of distance.

    Your perspective projection has a scale factor of 0.24 at the near plane (z=-10) and 6e-5 (0.00006) at the far plane (z=-40000). More generally, the scale factor for any given Z will be 2.4/(-z). This represents the amount by which the normalised device coordinates will change for a 1-unit change in eye coordinates.

    You can construct an orthographic projection for any given scale factor. If you choose a value of Z, you can create an orthographic projection which has the same scale factor as your perspective projection for that specific value of Z. Objects at that distance will appear the same size in either projection. Nearer objects will appear larger with the perspective projection, while farther objects will appear smaller.

Tags for this Thread

Posting Permissions

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