Opentk/Source/Bind/Specifications/Docs/glLogicOp.xml

276 lines
12 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="glLogicOp">
<refmeta>
<refmetainfo>
<copyright>
<year>1991-2006</year>
<holder>Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
<refentrytitle>glLogicOp</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>glLogicOp</refname>
<refpurpose>specify a logical pixel operation for color index rendering</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glLogicOp</function></funcdef>
<paramdef>GLenum <parameter>opcode</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>opcode</parameter></term>
<listitem>
<para>
Specifies a symbolic constant that selects a logical operation.
The following symbols are accepted:
<constant>GL_CLEAR</constant>,
<constant>GL_SET</constant>,
<constant>GL_COPY</constant>,
<constant>GL_COPY_INVERTED</constant>,
<constant>GL_NOOP</constant>,
<constant>GL_INVERT</constant>,
<constant>GL_AND</constant>,
<constant>GL_NAND</constant>,
<constant>GL_OR</constant>,
<constant>GL_NOR</constant>,
<constant>GL_XOR</constant>,
<constant>GL_EQUIV</constant>,
<constant>GL_AND_REVERSE</constant>,
<constant>GL_AND_INVERTED</constant>,
<constant>GL_OR_REVERSE</constant>, and
<constant>GL_OR_INVERTED</constant>. The initial value is <constant>GL_COPY</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="description"><title>Description</title>
<para>
<function>glLogicOp</function> 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
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry>
using the symbolic constant <constant>GL_COLOR_LOGIC_OP</constant> for RGBA mode or
<constant>GL_INDEX_LOGIC_OP</constant> for color index mode. The initial value is
disabled for both operations.
</para>
<para>
</para>
<informaltable frame="topbot">
<tgroup cols="2" align="left">
<colspec/>
<colspec/>
<thead>
<row>
<entry rowsep="1" align="left"><emphasis role="bold">
Opcode
</emphasis></entry>
<entry rowsep="1" align="left"><emphasis role="bold">
Resulting Operation
</emphasis></entry>
</row>
</thead>
<tbody>
<row>
<entry align="left">
<constant>GL_CLEAR</constant>
</entry>
<entry align="center">
0
</entry>
</row>
<row>
<entry align="left">
<constant>GL_SET</constant>
</entry>
<entry align="center">
1
</entry>
</row>
<row>
<entry align="left">
<constant>GL_COPY</constant>
</entry>
<entry align="center">
s
</entry>
</row>
<row>
<entry align="left">
<constant>GL_COPY_INVERTED</constant>
</entry>
<entry align="center">
~s
</entry>
</row>
<row>
<entry align="left">
<constant>GL_NOOP</constant>
</entry>
<entry align="center">
d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_INVERT</constant>
</entry>
<entry align="center">
~d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_AND</constant>
</entry>
<entry align="center">
s &amp; d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_NAND</constant>
</entry>
<entry align="center">
~(s &amp; d)
</entry>
</row>
<row>
<entry align="left">
<constant>GL_OR</constant>
</entry>
<entry align="center">
s | d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_NOR</constant>
</entry>
<entry align="center">
~(s | d)
</entry>
</row>
<row>
<entry align="left">
<constant>GL_XOR</constant>
</entry>
<entry align="center">
s ^ d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_EQUIV</constant>
</entry>
<entry align="center">
~(s ^ d)
</entry>
</row>
<row>
<entry align="left">
<constant>GL_AND_REVERSE</constant>
</entry>
<entry align="center">
s &amp; ~d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_AND_INVERTED</constant>
</entry>
<entry align="center">
~s &amp; d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_OR_REVERSE</constant>
</entry>
<entry align="center">
s | ~d
</entry>
</row>
<row>
<entry align="left">
<constant>GL_OR_INVERTED</constant>
</entry>
<entry align="center">
~s | d
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<parameter>opcode</parameter> is a symbolic constant chosen from the list above.
In the explanation of the logical operations,
<emphasis>s</emphasis> represents the incoming color index and
<emphasis>d</emphasis> 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.
</para>
</refsect1>
<refsect1 id="notes"><title>Notes</title>
<para>
Color index logical operations are always supported. RGBA logical
operations are supported only if the GL version is 1.1 or greater.
</para>
<para>
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 <citerefentry><refentrytitle>glDrawBuffer</refentrytitle></citerefentry>).
</para>
</refsect1>
<refsect1 id="errors"><title>Errors</title>
<para>
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>opcode</parameter> is not an accepted value.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <function>glLogicOp</function>
is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>
and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
</para>
</refsect1>
<refsect1 id="associatedgets"><title>Associated Gets</title>
<para>
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LOGIC_OP_MODE</constant>.
</para>
<para>
<citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_COLOR_LOGIC_OP</constant> or <constant>GL_INDEX_LOGIC_OP</constant>.
</para>
</refsect1>
<refsect1 id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>glAlphaFunc</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glBlendFunc</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glDrawBuffer</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry>
</para>
</refsect1>
<refsect1 id="Copyright"><title>Copyright</title>
<para>
Copyright <trademark class="copyright"></trademark> 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
</para>
</refsect1>
</refentry>