glOrtho or gluPerspective ....

Hello guys!!!

Can someone explain me witch is the diference between glOrtho and gluPerspective, I was trying to draw some lines in the screen using gluPerspective, and it didn´t work, then I use glOrtho, and it works fine, why ???

Thank you for the moment

Best regards


Well, glOrtho is for orthographic projection and gluPerspective is for perspective projection. As for the difference, in orthographic projection the “rays” passing through the pixels are all parallel whereas in perspective projection they all “shoot out” from the eye an pass through the pixels. I suggest you read a 3D computer graphics book (the Foley & Van Dam is a must) to fully understand the mechanics of 3D to 2D projection.

Ok Ok,

Witch is the better way to use, if I’m developing a CAD system ?

Thank ou for the moment

Best regards


Very nice answer Olive…

In a CAD environment, orthographic projection is the way to go. You can place objects “on top of” eachother without messing with the fact that objects gets smaller the further away they are, which is the case in perspective projection.

Right, Bob. But most CAD’s have the possibility to look at the model in perspective mode. For construction its useless, but when you look the first time at a model, it gives you a better understanding of the shape (IMHO).


Hello Kilam,

Is it what I was thinking about, when I’m creating the CAD model, it is better to use an Orthogonal projection, but when we want to view, like in a shading view, it’s better to use a perpective projection.

Thank you guys,

Best regards


PS.: But can someone explain me why the lines didn’t appear using the Perpective projection, I just replace the perspective code to the orthogonal code, and then it works.

Kilam: Yeah, of course, but I was refering to the construction part though. So I say it too: Ortho for construction and perspective for viewing

Kurt Cob,

can you post the glFrustum or gluPerspective code line?

One suggestion why you arent seeing what you render with a perspective projection matrix…

When you set up your perspective matrix, the default ‘camera’ position is (0,0,0). You viewing direction is down the -Z axis. This isnt an actual camera, its where you are viewing from in world coordinates.
So my guess is you didnt transform your rendered objects away from the ‘camera’ sufficiently enough to view them.

glTranslatef(0., 0., -10.);
glutSolidSphere(3, 25, 25);

If you are contemplating coding a useable solid modeler, you have your work cut out for you. This is by no means an easy task.


Thanks Sean,
I will try to do that, sorry for the long time, that this reply took, I had particular problems.

Thank you guys for all your help.

Best regards