2009-03-08 00:46:58 +00:00
|
|
|
<?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">
|
2013-11-03 11:43:50 +00:00
|
|
|
<refentryinfo>
|
|
|
|
<copyright>
|
|
|
|
<year>1991-2006</year>
|
|
|
|
<holder>Silicon Graphics, Inc.</holder>
|
|
|
|
</copyright>
|
2013-12-15 21:32:32 +00:00
|
|
|
<copyright>
|
|
|
|
<year>2010-2013</year>
|
|
|
|
<holder>Khronos Group</holder>
|
|
|
|
</copyright>
|
2013-11-03 11:43:50 +00:00
|
|
|
</refentryinfo>
|
2009-03-08 00:46:58 +00:00
|
|
|
<refmeta>
|
|
|
|
<refentrytitle>glLogicOp</refentrytitle>
|
|
|
|
<manvolnum>3G</manvolnum>
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
|
|
<refname>glLogicOp</refname>
|
2010-11-21 14:34:29 +00:00
|
|
|
<refpurpose>specify a logical pixel operation for rendering</refpurpose>
|
2009-03-08 00:46:58 +00:00
|
|
|
</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,
|
2010-11-21 14:34:29 +00:00
|
|
|
is applied between the incoming RGBA color
|
|
|
|
and the RGBA color at the corresponding location in the
|
2009-03-08 00:46:58 +00:00
|
|
|
frame buffer.
|
|
|
|
To enable or disable the logical operation, call
|
|
|
|
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry>
|
2010-11-21 14:34:29 +00:00
|
|
|
using the symbolic constant <constant>GL_COLOR_LOGIC_OP</constant>. The initial value is
|
|
|
|
disabled.
|
2009-03-08 00:46:58 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
</para>
|
2013-12-15 21:32:32 +00:00
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<colspec align="left" />
|
|
|
|
<colspec align="center" />
|
2009-03-08 00:46:58 +00:00
|
|
|
<thead>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<emphasis role="bold"> Opcode </emphasis>
|
|
|
|
</entry>
|
|
|
|
<entry>
|
|
|
|
<emphasis role="bold"> Resulting Operation </emphasis>
|
|
|
|
</entry>
|
2009-03-08 00:46:58 +00:00
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_CLEAR</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
0
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_SET</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
1
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_COPY</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
s
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_COPY_INVERTED</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
~s
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_NOOP</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_INVERT</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
~d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_AND</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
s & d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_NAND</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
~(s & d)
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_OR</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
s | d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_NOR</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
~(s | d)
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_XOR</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
s ^ d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_EQUIV</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
~(s ^ d)
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_AND_REVERSE</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
s & ~d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_AND_INVERTED</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
~s & d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_OR_REVERSE</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
s | ~d
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
<constant>GL_OR_INVERTED</constant>
|
2009-03-08 00:46:58 +00:00
|
|
|
</entry>
|
2013-12-15 21:32:32 +00:00
|
|
|
<entry>
|
|
|
|
~s | d
|
2009-03-08 00:46:58 +00:00
|
|
|
</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,
|
2010-11-21 14:34:29 +00:00
|
|
|
<emphasis>s</emphasis> represents the incoming color and
|
|
|
|
<emphasis>d</emphasis> represents the color in the frame buffer.
|
2009-03-08 00:46:58 +00:00
|
|
|
Standard C-language operators are used.
|
|
|
|
As these bitwise operators suggest,
|
|
|
|
the logical operation is applied independently to each bit pair of the
|
2010-11-21 14:34:29 +00:00
|
|
|
source and destination colors.
|
2009-03-08 00:46:58 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 id="notes"><title>Notes</title>
|
|
|
|
<para>
|
2010-11-21 14:34:29 +00:00
|
|
|
When more than one RGBA color buffer is enabled for drawing,
|
2009-03-08 00:46:58 +00:00
|
|
|
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>
|
2010-11-21 14:34:29 +00:00
|
|
|
<para>
|
|
|
|
Logic operations have no effect on floating point draw buffers. However, if
|
|
|
|
<constant>GL_COLOR_LOGIC_OP</constant> is enabled, blending is still disabled
|
|
|
|
in this case.
|
|
|
|
</para>
|
2009-03-08 00:46:58 +00:00
|
|
|
</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>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 id="associatedgets"><title>Associated Gets</title>
|
|
|
|
<para>
|
|
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LOGIC_OP_MODE</constant>.
|
|
|
|
</para>
|
|
|
|
<para>
|
2010-11-21 14:34:29 +00:00
|
|
|
<citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_COLOR_LOGIC_OP</constant>.
|
2009-03-08 00:46:58 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 id="seealso"><title>See Also</title>
|
|
|
|
<para>
|
|
|
|
<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>
|
2013-12-15 21:32:32 +00:00
|
|
|
Copyright <trademark class="copyright"></trademark> 1991-2006 Silicon Graphics, Inc.
|
|
|
|
Copyright <trademark class="copyright"></trademark> 2010-2013 Khronos Group.
|
|
|
|
This document is licensed under the SGI Free Software B License.
|
|
|
|
For details, see
|
2009-03-08 00:46:58 +00:00
|
|
|
<ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|