xenocara/doc/gl-docs/GL/gl/logicop.3gl
2006-11-29 17:00:35 +00:00

113 lines
3.1 KiB
Plaintext

'\" et
'\"! eqn|tbl | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 logicop.g
.ds Xs 60568 5 logicop.gl
.TH GLLOGICOP 3G
.SH NAME
.B "glLogicOp
\- specify a logical pixel operation for color index rendering
.SH C SPECIFICATION
void \f3glLogicOp\fP(
GLenum \fIopcode\fP )
.nf
.fi
.SH PARAMETERS
.TP \w'\f2opcode\fP\ \ 'u
\f2opcode\fP
Specifies a symbolic constant that selects a logical operation.
The following symbols are accepted:
\%\f3GL_CLEAR\fP,
\%\f3GL_SET\fP,
\%\f3GL_COPY\fP,
\%\f3GL_COPY_INVERTED\fP,
\%\f3GL_NOOP\fP,
\%\f3GL_INVERT\fP,
\%\f3GL_AND\fP,
\%\f3GL_NAND\fP,
\%\f3GL_OR\fP,
\%\f3GL_NOR\fP,
\%\f3GL_XOR\fP,
\%\f3GL_EQUIV\fP,
\%\f3GL_AND_REVERSE\fP,
\%\f3GL_AND_INVERTED\fP,
\%\f3GL_OR_REVERSE\fP, and
\%\f3GL_OR_INVERTED\fP. The initial value is \%\f3GL_COPY\fP.
.SH DESCRIPTION
\%\f3glLogicOp\fP specifies a logical operation that,
when enabled,
is applied between the incoming color index or RGBA color
and the color index or RGBA color at the corresponding location in the
frame buffer.
To enable or disable the logical operation, call
\%\f3glEnable\fP and \%\f3glDisable\fP
using the symbolic constant \%\f3GL_COLOR_LOGIC_OP\fP for RGBA mode or
\%\f3GL_INDEX_LOGIC_OP\fP for color index mode. The initial value is
disabled for both operations.
.P
.ne
.TS
center;
lb lb
l c.
_
Opcode Resulting Operation
_
\%\f3GL_CLEAR\fP 0
\%\f3GL_SET\fP 1
\%\f3GL_COPY\fP s
\%\f3GL_COPY_INVERTED\fP ~s
\%\f3GL_NOOP\fP d
\%\f3GL_INVERT\fP ~d
\%\f3GL_AND\fP s & d
\%\f3GL_NAND\fP ~(s & d)
\%\f3GL_OR\fP s | d
\%\f3GL_NOR\fP ~(s | d)
\%\f3GL_XOR\fP s ^ d
\%\f3GL_EQUIV\fP ~(s ^ d)
\%\f3GL_AND_REVERSE\fP s & ~d
\%\f3GL_AND_INVERTED\fP ~s & d
\%\f3GL_OR_REVERSE\fP s | ~d
\%\f3GL_OR_INVERTED\fP ~s | d
_
.TE
\f2opcode\fP is a symbolic constant chosen from the list above.
In the explanation of the logical operations,
\f2s\fP represents the incoming color index and
\f2d\fP represents the index 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 indices or colors.
.SH NOTES
Color index logical operations are always supported. RGBA logical
operations are supported only if the GL version is 1.1 or greater.
.P
When more than one RGBA color or index 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 \%\f3glDrawBuffer\fP).
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2opcode\fP is not an accepted value.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glLogicOp\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_LOGIC_OP_MODE\fP.
.br
\%\f3glIsEnabled\fP with argument \%\f3GL_COLOR_LOGIC_OP\fP or \%\f3GL_INDEX_LOGIC_OP\fP.
.SH SEE ALSO
\%\f3glAlphaFunc(3G)\fP,
\%\f3glBlendFunc(3G)\fP,
\%\f3glDrawBuffer(3G)\fP,
\%\f3glEnable(3G)\fP,
\%\f3glStencilOp(3G)\fP