glLogicOp(3G) OpenGL Reference glLogicOp(3G)
NAME
glLogicOp - specify a logical pixel operation for color index rendering
C SPECIFICATION
void glLogicOp( GLenum opcode )
PARAMETERS
opcode Specifies a symbolic constant that selects a logical operation.
The following symbols are accepted: GLCLEAR, GLSET, GLCOPY,
GLCOPYINVERTED, GLNOOP, GLINVERT, GLAND, GLNAND, GLOR,
GLNOR, GLXOR, GLEQUIV, GLANDREVERSE, GLANDINVERTED,
GLORREVERSE, and GLORINVERTED. The initial value is GLCOPY.
DESCRIPTION
glLogicOp specifies a logical operation that, when enabled, is applied
between the incoming color index or RGBA color and the color index or
RGBA color at the corresponding location in the frame buffer. To enable
or disable the logical operation, call glEnable and glDisable using the
symbolic constant GLCOLORLOGICOP for RGBA mode or GLINDEXLOGICOP
for color index mode. The initial value is disabled for both operations.
opcode is a symbolic constant chosen from the list below. In the
explanation of the logical operations, s represents each of the 4
incoming color components, or it represents the color index. d represents
the corresponding value in the frame buffer. Standard C-language
operators are used. As these bitwise operators suggest, the logical
operation is applied independently to each bit pair of the source and
destination indices or color components.
opcode resulting value
__________________________________
GLCLEAR 0
GLSET 1
GLCOPY s
GLCOPYINVERTED !s
GLNOOP d
GLINVERT ~d
GLAND s & d
GLNAND ~(s & d)
GLOR s | d
GLNOR ~(s | d)
GLXOR s ^ d
GLEQUIV ~(s ^ d)
GLANDREVERSE s & ~d
GLANDINVERTED ~s & d
GLORREVERSE s | ~d
GLORINVERTED ~s | d
Page 1
glLogicOp(3G) OpenGL Reference glLogicOp(3G)
NOTES
Color index logical operations are always supported. RGBA logical
operations are supported only if the GL version is 1.1 or greater.
(However, if the GL version is 1.0, then in RGBA mode, glLogicOp is used
to specify a blending operation. The specified logicop is used if
blending is enabled and the blend equation is set to GLLOGICOP. (see
glBlendEquationExt).)
When more than one RGBA color or index buffer is enabled for drawing,
logical operations are performed separately for each enabled buffer,
using for the destination value the contents of that buffer (see
glDrawBuffer).
ERRORS
GLINVALIDENUM is generated if opcode is not an accepted value.
GLINVALIDOPERATION is generated if glLogicOp is executed between the
execution of glBegin and the corresponding execution of glEnd.
ASSOCIATED GETS
glGet with argument GLLOGICOPMODE
glIsEnabled with argument GLCOLORLOGICOP or GLINDEXLOGICOP.
SEE ALSO
glAlphaFunc, glBlendFunc, glBlendEquationEXT, glDrawBuffer, glEnable,
glStencilOp
Page 2