How can I make a call to glFrustum() that matches my call to gluPerspective()?

Answer

The field of view (fov) of your glFrustum() call is:

fov*0.5 = arctan ((top-bottom)*0.5 / near)

Since bottom == -top for the symmetrical projection that gluPerspective() produces, then:

top = tan(fov*0.5) * near
bottom = -top

Note: fov must be in radians for the above formulae to work with the C math library. If you have comnputed your fov in degrees (as in the call to gluPerspective()), then calculate top as follows:

top = tan(fov*3.14159/360.0) * near

The left and right parameters are simply functions of the top, bottom, and aspect:

left = aspect * bottom
right = aspect * top

The OpenGL Reference Manual (where do I get this?) shows the matrices produced by both functions.

All opengl Questions

Ask your interview questions on opengl

Write Your comment or Questions if you want the answers on opengl from opengl Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---