Gambas Documentation - /comp/gb.opengl/gl/clear

# Gl.Clear (gb.opengl)

Static Sub Clear ( Mask As Integer )

Clear buffers to preset values.

### Parameters

mask

  Bitwise OR of masks that indicate the buffers to be cleared. The three masks are Gl.COLOR_BUFFER_BIT, Gl.DEPTH_BUFFER_BIT, and Gl.STENCIL_BUFFER_BIT.

### Description

Gl.Clear sets the bitplane area of the window to values previously selected by Gl.ClearColor, Gl.ClearDepth, and Gl.ClearStencil. Multiple color buffers can be cleared simultaneously by selecting more than one buffer at a time using Gl.DrawBuffer.

The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of Gl.Clear. The scissor box bounds the cleared region. Alpha function, blend function, logical operation, stenciling, texture mapping, and depth-buffering are ignored by Gl.Clear.

Gl.Clear takes a single argument that is the bitwise OR of several values indicating which buffer is to be cleared.

The values are as follows:

Gl.COLOR_BUFFER_BIT

  Indicates the buffers currently enabled for color writing.

Gl.DEPTH_BUFFER_BIT

  Indicates the depth buffer.

Gl.STENCIL_BUFFER_BIT

  Indicates the stencil buffer.

The value to which each buffer is cleared depends on the setting of the clear value for that buffer.

### Notes

If a buffer is not present, then a Gl.Clear directed at that buffer has no effect.

### Errors

Gl.INVALID_VALUE is generated if any bit other than the three defined bits is set in mask.

### Associated Gets

Gl.Get with argument Gl.DEPTH_CLEAR_VALUE

Gl.Get with argument Gl.COLOR_CLEAR_VALUE

Gl.Get with argument Gl.STENCIL_CLEAR_VALUE

### See Also

Gl.ClearColor, Gl.ClearDepth, Gl.ClearStencil, Gl.ColorMask, Gl.DepthMask, Gl.DrawBuffer, Gl.Scissor, Gl.StencilMask

Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB.

➡ See original documentation