Question: glFrustrum vs glPerspective

Started by
4 comments, last by malachii 22 years, 1 month ago
I''m reading the red and blue books, and am trying to understand the difference between these two functions. Actually, I''m trying to understand glFrustrum. How can it know the angle of your frustrum if you''re trying to create a projection? It only asks for top, bottom, left, right, front, back doubles. Thanks for your time, Mal the confused.
Advertisement
gluperspective calls glfrustum (its just an easier method to set up the viewing frustum)

http://uk.geocities.com/sloppyturds/gotterdammerung.html
To satisfy my own personal curiosity, I''m trying to find some information on glFrustrum. I can''t seem to figure out how to use it, without using gluPerspective.

Any help would be appreciated.

Thanks.

Mal the less confused.
glFrustum is more general than gluPerspective.
As zedzek said, it''s only shortcut to the glFrustum

double left, right;
double bottom, top;
double zfar, znear;

top = tan (FOV*3.14159/360.0)*NEARPLANE;
bottom = -top;
left = ASPECT*bottom;
right = ASPECT*top;

glFrustum (left, right, bottom, top, NEARPLANE, FARPLANE);

this corresponds call:

gluPerspective (FOV, ASPECT, NEARPLANE, FARPLANE);

wasn''t that hard.
Ok thanks for the code. That helps a lot. One question though. Where does ASPECT come from? From the window dimensions directly?

Mal.
Aspect is Width divided by Height

------------
- outRider -

This topic is closed to new replies.

Advertisement