Sign in to follow this  

on non-symmetric frustum

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this