/ comp / gb.opengl / gl / frustum
Gl.Frustum (gb.opengl)
Syntax

    STATIC SUB Frustum ( Left AS Float, Right AS Float, Bottom AS Float, Top AS Float, Near AS Float, Far AS Float )

### Multiply the current matrix by a perspective matrix

#### Parameters

- Left, Right specify the coordinates for the left and right vertical clipping planes.

- Bottom, Top specify the coordinates for the bottom and top horizontal clipping planes.

- Near, Far specify the distances to the near and far depth clipping planes. Both distances must be positive.

#### Description

Gl.Frustum describes a perspective matrix that produces a perspective projection. (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
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, then M is replaced with M * F.

Use Gl.PushMatrix and Gl.PopMatrix 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 ld(r) bits of depth buffer precision are lost. Because r approaches infinity as Near approaches zero, Near must never be set to zero.

#### Errors

Gl.GL_INVALID_VALUE is generated if either Near or Far is not positive.
Gl.GL_INVALID_OPERATION is generated if Gl.Frustum is called between a call to Gl.Begin and the corresponding call to Gl.End.

#### Associated Gets

Gl.GetMatrixMode
Gl.GetModelviewMatrix
Gl.GetProjectionMatrix
Gl.GetTextureMatrix

### See also

Gl.Ortho , Gl.MatrixMode , Gl.MultMatrix, Gl.PushMatrix , Gl.Viewport