Multiplies the current matrix by a perspective matrix.
OpenGL C bindings library: libGL.a
void glFrustum(GLdouble Left, GLdouble Right, GLdouble Bottom, GLdouble Top, GLdouble Near, GLdouble Far)
The glFrustum subroutine describes a perspective matrix that produces a perspective projection.
The parameters (Left, Bottom, -Near) and (Right, Top, -Near)
specify the points on the near clipping plane that are mapped
to the lower left and upper right corners of the window, respectively,
assuming that the eye is located at (0, 0, 0). -Far specifies the location of the far clipping plane. Both Near and Far must be positive.
where the following statements apply:
The current matrix is multiplied by this matrix with the result replacing the current matrix. That is, if M is the current matrix and F is the frustum perspective matrix, M is replaced with MF.
Use glPushMatrix and glPopMatrix to save and restore the current matrix stack.
Depth buffer precision is affected by the values specified for Near and Far. The greater the ratio of Far to Near is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other. If r = Far / Near, roughly log2r bits of depth buffer precision are lost. Because r approaches infinity as Near approaches 0 (zero), Near must never be set to 0.
GL_INVALID_VALUE | Either Near or Far is not positive. |
GL_INVALID_OPERATION | The glFrustum subroutine is called between a call to glBegin and the corresponding call to glEnd. |
Associated gets for the glFrustum subroutine are as follows. (See the glGet subroutine for more information.)
glGet with argument GL_MATRIX_MODE
glGet with argument GL_MODELVIEW_MATRIX
glGet with argument GL_PROJECTION_MATRIX
glGet with argument GL_TEXTURE_MATRIX.
/usr/include/GL/gl.h | Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |
The glBegin or glEnd subroutine, glMatrixMode subroutine, glMultMatrix subroutine, glOrtho subroutine, glPushMatrix or glPopMatrix subroutine, glViewport subroutine.