Archived

This topic is now archived and is closed to further replies.

malachii

Question: glFrustrum vs glPerspective

Recommended Posts

malachii    122
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.

Share this post


Link to post
Share on other sites
zedzeek    528
gluperspective calls glfrustum (its just an easier method to set up the viewing frustum)

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
malachii    122
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.

Share this post


Link to post
Share on other sites
rickpeek    122
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.

Share this post


Link to post
Share on other sites