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

glLogicOp Subroutine

Purpose

Specifies a logical pixel operation for color index rendering.

Library

OpenGL C bindings library: libGL.a

C Syntax

void LogicOp(GLenum OperatorCode)

Parameters

OperatorCode Specifies a symbolic constant that selects a logical operation. The following symbols are accepted:
  • GL_CLEAR
  • GL_SET
  • GL_COPY
  • GL_COPY_INVERTED
  • GL_NOOP
  • GL_INVERT
  • GL_AND
  • GL_NAND
  • GL_OR
  • GL_NOR
  • GL_XOR
  • GL_EQUIV
  • GL_AND_REVERSE
  • GL_AND_INVERTED
  • GL_OR_REVERSE
  • GL_OR_INVERTED

Description

The glLogicOp subroutine specifies a logical operation that, when enabled, is applied between the incoming color and the color at the corresponding location in the frame buffer. The logical operation is enabled or disabled with the glEnable and glDisable subroutines using the GL_LOGIC_OP symbolic constant for color index mode or the GL_COLOR_LOGIC_OP for RGB mode.

The OperatorCode parameter specifies a symbolic constant chosen from the following list. In the explanation of the logical operations, s represents the incoming color index and d represents the index in the frame buffer. Standard C-language operators are used. As these bit-wise operators suggest, the logical operation is applied independently to each bit pair of the source and destination indexes.

Operation 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

Notes

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 the glDrawBuffer subroutine for information about specifying color buffers for drawing.)

The OperatorCode parameter must be one of the 16 accepted values. Other values result in an error.

Errors

GL_INVALID_ENUM OperatorCode is not an accepted value.
GL_INVALID_OPERATION The glLogicOp subroutine is called between a call to glBegin and the corresponding call to glEnd.

Associated Gets

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

glEnable or glDisable with argument GL_COLOR_LOGIC_OP for RGB mode or GL_INDEX_LOGIC_OP for color index mode.

glGet with argument GL_LOGIC_OP_MODE

glIsEnabled with argument GL_LOGIC_OP.

Files

/usr/include/GL/gl.h Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The glAlphaFunc subroutine, glBegin or glEnd subroutine, glBlendEquationEXT subroutine, glBlendFunc subroutine, glDrawBuffer subroutine, glEnable or Disable subroutine, glStencilOp subroutine.

OpenGL Overview.


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