• Advertisement
Sign in to follow this  

on non-symmetric frustum

This topic is 3446 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

Hi, These days I'm trying to define a view which keeps a rectangle exactly fill with the viewport while the camera move around(just changing the position not direction). Therefore I try to define the projection by glFrustum, my code is: The position and dimension of of the rectanlge,which is parallel to the xy plane are defined by lleft,lright,lbottom,ltop and lz fs=nearz/fabs(vz-lz); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum((lleft-viewx)*fs,(lright-viewx)*fs,(lbottom-viewy)*fs,(ltop-viewy)*fs,nearz,1000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(viewx,viewy,vz,viewx,viewy,lz,0,1,0); The code has no problem if the camera is at the center of the rectangle along z axis. However, when camera moves away, the rectangle is cliped. I wonder if I can use glFrustum like this, or I have missed something about the math. Thank you!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement