Archived

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

gluPerspective() and perspective viewing volume

This topic is 6164 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is an introductory question regarding gluPerspective() and/or glFrustum(). Okay, Let''s say you call gluPerspective() with a fov angle of 60 degrees, an aspect ratio of 4/3, a near of 0.0, and a far of 100.0... e.g.,
  
glViewport(0, 0, fWidth, fHeight);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

gluPerspective(60.0f, fWidth/fHeight, 0.0f, 100.0f);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
  
The range of *visible* x and y coords changes, depending on the z-coord used...in other words, you can see more units on the x and y axises for an object which is "farther away", than for one that''s "closer". I need an algorithm where you can retrieve the viewable range of x-coords and y-coords, given a specific z-coord. In otherwords, retrieve the width and the height of the "frustum" at a given z-coord. This would allow me to tell if an object is visible to the user at certain x/y coords given the z-coord. I ought to be able to figure this out, but haven''t been able to yet. Any suggestions would be appreciated--or if there''s any major errors in my logic, I''d love to be corrected. Thanks Rob

Share this post


Link to post
Share on other sites