Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The glLogicOp function specifies a logical pixel operation for color index rendering.
void glLogicOp(
GLenum opcode);
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 |
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
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. |
** 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.
glAlphaFunc, glBegin, glBlendFunc, glDrawBuffer, glEnable, glEnd, glIsEnabled, glStencilOp
Please sign in to use this experience.
Sign in