[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]

*OpenGL 1.1 for AIX: Reference Manual*

## glFrustum Subroutine

### Purpose

Multiplies the current matrix by a perspective matrix.

### Library

OpenGL C bindings library: **libGL.a**

### C Syntax

**void glFrustum(GLdouble ***Left***,**
** GLdouble ***Right***,**
** GLdouble ***Bottom***,**
** GLdouble ***Top***,**
** GLdouble ***Near***,**
** GLdouble ***Far***)**

### Parameters

*Left* |
Specifies a point on the left side of the clipping plane |

*Right* |
Specifies a point on the right side of the clipping plane. |

*Bottom* |
Specifies a point on the bottom of the clipping plane. |

*Top* |
Specifies a point on the top of the clipping plane. |

*Near* |
Specifies the location of the near clipping plane. This must be a positive value. |

*Far* |
Specifies the location of the far clipping plane. This must be a positive value. |

### Description

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.

The corresponding
matrix is:

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.

### Notes

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 log2*r* bits of depth buffer precision are lost. Because *r* approaches infinity as *Near* approaches 0 (zero), *Near* must never be set to 0.

### Errors

**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

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**.

### Files

**/usr/include/GL/gl.h** |
Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |

### Related Information

The **glBegin** or **glEnd** subroutine, **glMatrixMode** subroutine, **glMultMatrix** subroutine, **glOrtho** subroutine, **glPushMatrix** or **glPopMatrix** subroutine, **glViewport** subroutine.

OpenGL Overview.

[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]