glFrustum
[New
- Windows 95, OEM Service Release 2]
The glFrustum
function multiplies the current matrix by a perspective matrix.
void glFrustum(
GLdouble left, |
|
GLdouble right, |
|
GLdouble bottom, |
|
GLdouble top, |
|
GLdouble znear, |
|
GLdouble zfar |
|
); |
|
Parameters
left,
right
The coordinates
for the left and right vertical clipping planes.
bottom,
top
The
coordinates for the bottom and top horizontal clipping planes.
znear,
zfar
The distances
to the near and far depth clipping planes. Both distances must be positive.
Remarks
The glFrustum
function describes a perspective matrix that produces a perspective projection.
The (left, bottom, znear) and (right, top, znear)
parameters 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). The zfar parameter specifies the
location of the far clipping plane. Both znear and zfar must be
positive. The corresponding matrix is:
{bml bm25.BMP}
{bml bm26.BMP}
The glFrustum
function multiplies the current matrix 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, then glFrustum replaces M with M F.
Use glPushMatrix
Depth-buffer
precision is affected by the values specified for znear and zfar.
The greater the ratio of zfar to znear is, the less effective the
depth buffer will be at distinguishing between surfaces that are near each
other. If
{bml bm27.BMP}
roughly log (2) r
bits of depth buffer precision are lost. Because r approaches infinity
as znear approaches zero, you should never set znear to zero.
The following
functions retrieve information about glFrustum:
glGet
with argument GL_MATRIX_MODE
glGet with
argument GL_MODELVIEW_MATRIX
glGet with
argument GL_PROJECTION_MATRIX
glGet with
argument GL_TEXTURE_MATRIX
Error Codes
The following
are the error codes generated and their conditions.
Error
Code |
Condition |
GL_INVALID_VALUE
|
znear or zfar was not positive. |
GL_INVALID_OPERATION
|
glFrustum was called between a call to glBegin and the
corresponding call to glEnd. |
See Also