PDA

View Full Version : glOrtho or gluPerspective ....



KurtCob
10-15-2000, 12:14 PM
Hello guys!!! http://www.opengl.org/discussion_boards/ubb/smile.gif

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

Kurt

Olive
10-15-2000, 10:49 PM
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.

KurtCob
10-16-2000, 12:18 AM
Ok Ok,

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

Thank ou for the moment

Best regards

Kurt

jc
10-16-2000, 03:59 AM
Very nice answer Olive...

Bob
10-16-2000, 05:13 AM
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.

Kilam Malik
10-16-2000, 06:19 AM
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).

Kilam.

KurtCob
10-16-2000, 08:09 AM
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

Kurt

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.

Bob
10-17-2000, 02:59 AM
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 http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

Kilam Malik
10-17-2000, 04:36 AM
Kurt Cob,

can you post the glFrustum or gluPerspective code line?

SED
10-18-2000, 10:02 AM
Kurt,
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. http://www.opengl.org/discussion_boards/ubb/eek.gif

Sean

KurtCob
10-19-2000, 03:58 AM
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

Kurt