Gl.Accum
(gb.opengl)
Syntax
STATIC SUB Accum ( Operation AS Integer, Value AS Float )
Operate on the accumulation buffer
Parameters
- Operation specifies the accumulation buffer operation. Symbolic constants Gl.GL_ACCUM, Gl.GL_LOAD, Gl.GL_ADD, Gl.GL_MULT, and Gl.GL_RETURN are accepted.
- Value specifies a floating-point value used in the accumulation buffer operation. Operation determines how value is used.
Description
The accumulation buffer is an extended-range color buffer. Images are not rendered into it. Rather, images rendered into one of the color buffers are added to the contents of the accumulation buffer after rendering. Effects such as antialiasing (of points, lines, and polygons), motion blur, and depth of field can be created by accumulating images generated with different transformation matrices.
Each pixel in the accumulation buffer consists of red, green, blue, and alpha values. The number of bits per component in the accumulation buffer depends on the implementation. You can examine this number by calling Gl.GetAccumRedBits, Gl.GetAccumGreenBits, Gl.GetAccumBlueBits and Gl.GetAccumAlphaBits, respectively. Regardless of the number of bits per component, however, the range of values stored by each component is [-1, 1]. The accumulation buffer pixels are mapped one-to-one with frame buffer pixels.
Gl.Accum operates on the accumulation buffer. The first argument, Operation, is a constant that selects an accumulation buffer operation. The second argument, Value, is a floating-point value to be used in that operation. Five operations are specified: Gl.GL_ACCUM, Gl.GL_LOAD, Gl.GL_ADD, Gl.GL_MULT, and Gl.GL_RETURN.
All accumulation buffer operations are limited to the area of the current scissor box and are applied identically to the red, green, blue, and alpha components of each pixel. The contents of an accumulation buffer pixel component are undefined if the Gl.Accum operation results in a value outside the range [-1, 1].
- Gl.GL_ACCUM obtains Red, Green, Blue, and Alpha values from the buffer currently selected for reading (see Gl.ReadBuffer) Each component value is divided by 2 n - 1, where n is the number of bits allocated to each color component in the currently selected buffer. The result is a floating-point value in the range [0, 1], which is multiplied by value and added to the corresponding pixel component in the accumulation buffer, thereby updating the accumulation buffer.
- Gl.GL_LOAD similar to Gl.GL_ACCUM, except that the current value in the accumulation buffer is not used in the calculation of the new value. That is, the Red, Green, Blue, and Alpha values from the currently selected buffer are divided by 2 n - 1, multiplied by value, and then stored in the corresponding accumulation buffer cell, overwriting the current value.
- Gl.GL_ADD adds value to each Red, Green, Blue, and Alpha in the accumulation buffer.
- Gl.GL_MULT multiplies each Red, Green, Blue, and Alpha in the accumulation buffer by value and returns the scaled component to its corresponding accumulation buffer location.
- Gl.GL_RETURN transfers accumulation buffer values to the color buffer or buffers currently selected for writing. Each Red, Green, Blue, and Alpha component is multiplied by value, then multiplied by 2 n - 1, clamped to the range [0, 2 n - 1 ], and stored in the corresponding display buffer cell. The only fragment operations that are applied to this transfer are pixel ownership, scissor, dithering, and color writemasks.
The accumulation buffer is cleared by specifying Red, Green, Blue, and Alpha values to set it to with the
Gl.ClearAccum directive, and issuing a
Gl.Clear command with the accumulation buffer enabled.
 |
Only those pixels within the current scissor box are updated by any Gl.Accum operation.
|
Errors
Gl.GL_INVALID_ENUM is generated if Operation is not an accepted value.
Gl.GL_INVALID_OPERATION is generated if there is no accumulation buffer.
Gl.GL_INVALID_OPERATION is generated if Gl.Accum is called between a call to Gl.Begin and the corresponding call to Gl.End.
Associated Gets
Gl.GetAccumRedBits
Gl.GetAccumGreenBits
Gl.GetAccumBlueBits
Gl.GetAccumAlphaBits
See also
Gl.BlendFunc ,
Gl.Clear ,
Gl.ClearAccum , Gl.CopyPixels, Gl.LogicOp, Gl.PixelStore,
Gl.PixelTransfer, Gl.ReadPixels, Gl.ReadBuffer, Gl.Scissor, Gl.StencilOp.