[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.12 Framebuffers

Clearing buffers

Function: gl-clear-color r g b a

Sets the current clearing color. Each color value sould be a real number, and is clamped to [0.0,1.0].

Function: gl-clear-index c

Sets the current clearing color (in color index mode). c must be a real number.

Function: gl-clear-depth depth

Sets the current clearing depth value. Depth must be a real number and clamped to [0.0,1.0].

Function: gl-clear-stencil s

Sets the current clearing value of the stencil buffer.

Function: gl-clear-accum r g b a

Sets the current clearing value of accumulation buffer.

Function: gl-clear mask

Clears the specified buffer. Mask is a logical-or of the following constants.

GL_COLOR_BUFFER_BIT
GL_DEPTH_BUFFER_BIT
GL_ACCUM_BUFFER_BIT
GL_STENCIL_BUFFER_BIT

Selecting color buffers

Function: gl-draw-buffer mode

Selects (a) buffer(s) to which the image is rendered. Possible mode values are: GL_FRONT, GL_FRONT_LEFT, GL_FRONT_RIGHT, GL_BACK, GL_BACK_LEFT, GL_BACK_RIGHT, GL_LEFT, GL_RIGHT, GL_AUXi, GL_FRONT_AND_BACK, and GL_NONE.

Function: gl-read-buffer mode

Selects a color buffer as the source for reading pixels. Possible mode values are the same as gl-draw-buffer except GL_FRONT_AND_BACK and GL_NONE.

Masking buffers

Function: gl-index-mask mask

In color index mode, sets the mask of the color-index buffer. Mask is an exact integer.

Function: gl-color-mask r g b a

R, g, b and a are boolean values to specify whether the corresponding color channel should be written to the color buffer or not.

Function: gl-depth-mask flag

Flag is a boolean value specifies whether depth buffer should be written or not.

Function: gl-stencil-mask mask

Sets the mask bit pattern for the stencil buffer. Mask is an exact integer.

Testing and operating on fragments

Function: gl-scissor x y width height

Sets the scissor rectangle. If the scissor test is enabled (use (gl-enable GL_SCISSOR_TEST)), only the pixels that lie inside the rectangle are written.

Function: gl-alpha-func func ref

Sets the reference value and comparison function for the alpha test. Func may be either one of GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, or GL_NOTEQUAL. Ref sets the reference value, a real number clamped to be between 0.0 and 1.0.

Function: gl-stencil-func func ref mask

Sets the comparison function, the reference value, and a mask for stencil test. Func specifies the funciton, and its possible value is the same as gl-alpha-func's. Ref is an integer reference value, and mask is an integer specifying bitwise mask. Before the comparison, the reference value and the fragment value are taken bitwise AND by mask.

Function: gl-stencil-op func zfail zpass

Speficies how the stencil buffer should be modified by the result of the stencil test. Each three parameter can take one of the following values independently: GL_KEEP, GL_ZERO, GL_REPLACE, GL_INCR, GL_DECR, or GL_INVERT.

Function: gl-depth-func func

Sets the comparison function for the depth test. Func may be one of the following constant value: GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, or GL_NOTEQUAL.

Function: gl-depth-range nearv farv

Defines an encoding for z-coordinates. Nearv and farv define the minimum and maximum values that can be stored in the depth buffer. By default, they're 0.0 and 1.0, respectively.

Function: gl-logic-op opcode

Selects the logical operation to be performed, given an incoming (source) fragment and the pixel currently in the color buffer (destination). Opcode may be one of the following values: GL_CLEAR, GL_COPY, GL_NOOP, GL_SET, GL_COPY_INVERTED, GL_INVERT, GL_AND_REVERSE, GL_OR_REVERSE, GL_AND, GL_OR, GL_NAND, GL_NOR, GL_XOR, GL_EQUIV, GL_AND_INVERTED or GL_OR_INVERTED.

Function: gl-accum op value

Sets the accumulation buffer operation mode. Op may be one of the following values:

GL_ACCUM

Reads each pixel from the current selected buffer to read (by gl-read-buffer), multiplies its values by value, and adds the result into the accumulation buffer.

GL_LOAD

Same as GL_ACCUM but replacing the accumulation buffer by the result of multiplication, instead of adding it.

GL_RETURN

Takes the values from accumulation buffer, multiplies them with value, then write it to the current color buffer to write (by gl-draw-buffer).

GL_ADD

Adds value to each pixel in the accumulation buffer and write it back.

GL_MULT

Multiplies value to each pixel in the accumulation buffer and write it back. The result value is clamped to [-1.0, 1.0].


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Shiro Kawai on June, 7 2008 using texi2html 1.78.