[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

glAccum Subroutine

Purpose

Operates on the accumulation buffer.

Library

OpenGL C bindings library: libGL.a

C Syntax

void glAccum(GLenum Operation, GLfloat Value)

Parameters

Operation Specifies the accumulation buffer operation. Symbolic constants GL_LOAD, GL_ACCUM, GL_MULT, GL_ADD, and GL_RETURN are accepted.
Value Specifies a floating-point value used in the accumulation buffer operation. The Operation parameter 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 (RGBA) values. The number of bits per component in the accumulation buffer depends on the implementation. You can examine this number by calling glGetInteger four times, with arguments GL_ACCUM_RED_BITS, GL_ACCUM_GREEN_BITS, GL_ACCUM_BLUE_BITS, and GL_ACCUM_ALPHA_BITS, respectively. (See the glGet subroutine for more information on glGetInteger.) 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 1-to-1 with frame buffer pixels.

The glAccum subroutine operates on the accumulation buffer. The first argument, Operation, is a symbolic 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_LOAD, GL_ACCUM, GL_ADD, GL_MULT, and GL_RETURN.

All accumulation buffer operations are limited to the area of the current scissor box and are applied identically to the RGBA components of each pixel. The contents of an accumulation buffer pixel component are undefined if the glAccum operation results in a value outside the range [-1,1].

The operations are:

GL_ACCUM Obtains RGBA values from the buffer currently selected for reading. (See glReadBuffer.) Each component value is divided by 2n-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_LOAD Functions similarly to GL_ACCUM, except that the current value in the accumulation buffer is not used in the calculation of the new value. That is, the RGBA values from the currently selected buffer are divided by 2n-1, multiplied by Value, and then stored in the corresponding accumulation buffer cell, overwriting the current value.
GL_ADD Adds Value to each R, G, B, and A in the accumulation buffer.
GL_MULT Multiplies each RGBA in the accumulation buffer by Value and returns the scaled component to its corresponding accumulation buffer location.
GL_RETURN Transfers accumulation buffer values to the color buffer or buffers currently selected for writing. Each RGBA component is multiplied by Value, then multiplied by 2n-1, clamped to the range [0, 2n-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 R, G, B, A values to set it to with the glClearAccum directive, and then issuing a glClear subroutine with the accumulation buffer enabled.

Notes

All glAccum operations update only those pixels within the current scissor box.

Errors

GL_INVALID_ENUM Operation is set to an unaccepted value.
GL_INVALID_OPERATION There is no accumulation buffer.
GL_INVALID_OPERATION The glAccum subroutine is called between a call to glBegin and the corresponding call to glEnd.

Associated Gets

Associated gets for the glAccum subroutine are as follows. (See the glGet subroutine for more information.)

glGet with argument GL_ACCUM_RED_BITS

glGet with argument GL_ACCUM_GREEN_BITS

glGet with argument GL_ACCUM_BLUE_BITS

glGet with argument GL_ACCUM_ALPHA_BITS.

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, glBlendFunc subroutine, glClear subroutine, glClearAccum subroutine, glCopyPixels subroutine, glLogicOp subroutine, glPixelStore subroutine, glPixelTransfer subroutine, glReadBuffer subroutine, glReadPixels subroutine, glScissor subroutine, glStencilOp subroutine.

OpenGL Overview.


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