Gl.LogicOp (gb.opengl)

Static Sub LogicOp ( Opcode As Integer )

Specify a logical pixel operation for rendering.

Parameters

opcode

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, and Gl.OR_INVERTED. The initial value is Gl.COPY.

Description

Gl.LogicOp specifies a logical operation that, when enabled, is applied between the incoming RGBA color and the RGBA color at the corresponding location in the frame buffer. To enable or disable the logical operation, call Gl.Enable and Gl.Disable using the symbolic constant Gl.COLOR_LOGIC_OP. The initial value is disabled.

Opcode Resulting Operation
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

opcode is a symbolic constant chosen from the list above. In the explanation of the logical operations, s represents the incoming color and d represents the color 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 colors.

Notes

When more than one RGBA color 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 Gl.DrawBuffer).

Logic operations have no effect on floating point draw buffers. However, if Gl.COLOR_LOGIC_OP is enabled, blending is still disabled in this case.

Errors

Gl.INVALID_ENUM is generated if opcode is not an accepted value.

Associated Gets

Gl.Get with argument Gl.LOGIC_OP_MODE.

Gl.IsEnabled with argument Gl.COLOR_LOGIC_OP.

See also

Gl.Enable, Gl.StencilOp

See original documentation on OpenGL website