View Full Version : Conversion from gluPerspective to gluOrtho

explorer101

12-29-2014, 01:53 AM

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.

GClements

12-29-2014, 05:22 AM

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.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.