Jump to content
  • Advertisement
Sign in to follow this  

on non-symmetric frustum

This topic is 3663 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!