glLogicOp
The glLogicOp function specifies a logical pixel operation for color index rendering.
void glLogicOp(
GLenum opcode);
Parameters
- opcode
A symbolic constant that selects a logical operation. The following symbols are accepted where s equals the value of the source bit and d is the value of the destination bit:Opcode Resulting Value GL_CLEAR 0 GL_SET 1 GL_COPY s GL_COPY_INVERTED !s GL_NOOP d GL_INVERT !d GL_AND s & d GL_NAND !(s & d) GL_OR s | d GL_NOR !(s | d) GL_XOR s ^ d GL_EQUIV !(s ^ d) GL_AND_REVERSE s & !d GL_AND_INVERTED !s & d GL_OR_REVERSE s | !d GL_OR_INVERTED !s | d
Remarks
The glLogicOp function specifies a logical operation that, when enabled, is applied between the incoming color index and the color index at the corresponding location in the framebuffer. The logical operation is enabled or disabled with glEnable and glDisable using the symbolic constant GL_LOGIC_OP.
The opcode parameter is a symbolic constant chosen from the list below. In the explanation of the logical operations, s represents the incoming color index and d represents the index in the framebuffer. 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 indexes.
Logical pixel operations are not applied to RGBA color buffers.
When more than one color-index buffer is enabled for drawing, logical operations are done separately for each enabled buffer, using the contents of that buffer for the destination index (see glDrawBuffer).
The opcode parameter must be one of the 16 accepted values. Other values result in an error.
The following functions retrieve information related to glLogicOp:
glGet with argument GL_LOGIC_OP_MODE
glIsEnabled with argument GL_LOGIC_OP
Error Codes
The following are the error codes generated and their conditions.
Error code | Condition |
---|---|
GL_INVALID_ENUM | opcode was not an accepted value. |
GL_INVALID_OPERATION | glLogicOp was called between a call to glBegin and the corresponding call to glEnd. |
Requirements
** Windows NT/2000:** Requires Windows NT 3.5 or later.
** Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
** Header:** Declared in Gl.h.
** Library:** Use Opengl32.lib.
See Also
glAlphaFunc, glBegin, glBlendFunc, glDrawBuffer, glEnable, glEnd, glIsEnabled, glStencilOp