PDA

View Full Version : how to change the projected plane



xn1924
09-23-2012, 08:02 AM
http://tau.rghost.ru/40533001/image.png
as the diagram above,i only know two methods gluPerspective and gluFrustum which probably project objects to the default plane .my target is to invert the projected plane from the default one to one expected. I doubt if there existed one method in OpenGL .welcome any helpful reply:)

Dark Photon
09-23-2012, 06:50 PM
From your diagram, it appears you just want a standard off-axis (asymmetric) perspective view frustum.

The actual (compatibility profile) GL calls that set the frustum are glFrustum (general perspective) and glOrtho (general orthographic). The GLU calls gluPerspective (symmetric perspective) and gluOrtho2D (2D orthographic) are just wrappers around the underlying glFrustum and glOrtho calls.

glFrustum (http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml) is what you want, as with it you can specify a symmetric perspective frustum or an asymmetric perspective frustum (the latter being what you want).

Take your "expected projected plane" and your eyepoint. Draw a vector through the eyepoint normal to the projection plane. That is your eye-space -Z axis. The distance from the eye to the projection plane is your "near" clip value. And on this plane is where the left, right, bottom, and top values are defined (which define the edges of your view frustum on the near clip plane). That specifies values for all of the glFrustum parameters except your far clip plane distance. Choose to-taste.