Before a fragment is written to the framebuffer, a logical operation is applied which uses the incoming fragment values as source (s) and/or those currently stored in the color buffer as destination (d). After the selected operation is completed, destination is overwritten. Logical operations are performed independently for each Red, Green, Blue and Alpha value and if the framebuffer has multiple color attachments, the logical operation is computed and applied separately for each color buffer.
If Logic Op is enabled, OpenGL behaves as if Blending is disabled regardless whether it was previously enabled.
In order to apply the Logicial Operation, use
GL.Enable( EnableCap.ColorLogicOp ); GL.Disable( EnableCap.ColorLogicOp ); // default
Note: If you use EnableCap.LogicOp or EnableCap.IndexLogicOp, only indexed color buffers (8 Bit) are affected.
To select the logical operation to be performed, use
GL.LogicOp( op ); where op is by default LogicOp.Copy.
The state of LogicOp can be queried with
Result = GL.IsEnabled( EnableCap.LogicOp );
Which operation has been set through GL.LogicOp() can be queried with
GL.GetInteger( GetPName.LogicOpMode, ... )