<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glLogicOp</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glLoadName.3G.xml" title="glLoadName"/><link rel="next" href="glMap1.3G.xml" title="glMap1"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glLogicOp</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glLoadName.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glMap1.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glLogicOp.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glLogicOp.3G-name"/><h2>Name</h2><p>glLogicOp &#8212; specify a logical pixel operation for color index rendering</p></div><div class="refsynopsisdiv"><a name="glLogicOp.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glLogicOp</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>opcode</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glLogicOp.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glLogicOp</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>opcode</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glLogicOp.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>opcode</tt></i></span></dt><dd>
						Specifies a symbolic constant that selects a logical operation. The following symbols are accepted:
						<tt>GL_CLEAR</tt>, <tt>GL_SET</tt>, <tt>GL_COPY</tt>,
						<tt>GL_COPY_INVERTED</tt>, <tt>GL_NOOP</tt>, <tt>GL_INVERT</tt>,
						<tt>GL_AND</tt>, <tt>GL_NAND</tt>, <tt>GL_OR</tt>,
						<tt>GL_NOR</tt>, <tt>GL_XOR</tt>, <tt>GL_EQUIV</tt>,
						<tt>GL_AND_REVERSE</tt>, <tt>GL_AND_INVERTED</tt>,
						<tt>GL_OR_REVERSE</tt>, and <tt>GL_OR_INVERTED</tt>. The initial value is
						<tt>GL_COPY</tt>.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glLogicOp.3G-description"/><h2>Description</h2><p>
			<tt>glLogicOp</tt> 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 <a href="glEnable.3G.xml"><tt>glEnable</tt></a> and <a href="glEnable.3G.xml"><tt>glDisable</tt></a> using the symbolic constant <tt>GL_COLOR_LOGIC_OP</tt> for RGBA
			mode or <tt>GL_INDEX_LOGIC_OP</tt> for color index mode. The initial value is disabled for both operations.
		</p><div class="informaltable"><table border="1"><colgroup><col/><col/></colgroup><tbody><tr><td><span class="bold"><b>Opcode</b></span></td><td><span class="bold"><b>Resulting Operation</b></span></td></tr><tr><td><tt>GL_CLEAR</tt></td><td align="center">0</td></tr><tr><td><tt>GL_SET</tt></td><td align="center">1</td></tr><tr><td><tt>GL_COPY</tt></td><td align="center">s</td></tr><tr><td><tt>GL_COPY_INVERTED</tt></td><td align="center">~s</td></tr><tr><td><tt>GL_NOOP</tt></td><td align="center">d</td></tr><tr><td><tt>GL_INVERT</tt></td><td align="center">~d</td></tr><tr><td><tt>GL_AND</tt></td><td align="center">s &amp; d</td></tr><tr><td><tt>GL_NAND</tt></td><td align="center">~(s &amp; d)</td></tr><tr><td><tt>GL_OR</tt></td><td align="center">s d</td></tr><tr><td><tt>GL_NOR</tt></td><td align="center">~(s d)</td></tr><tr><td><tt>GL_XOR</tt></td><td align="center">s ^ d</td></tr><tr><td><tt>GL_EQUIV</tt></td><td align="center">~(s ^ d)</td></tr><tr><td><tt>GL_AND_REVERSE</tt></td><td align="center">s &amp; ~d</td></tr><tr><td><tt>GL_AND_INVERTED</tt></td><td align="center">~s &amp; d</td></tr><tr><td><tt>GL_OR_REVERSE</tt></td><td align="center">s ~d</td></tr><tr><td><tt>GL_OR_INVERTED</tt></td><td align="center">~s d</td></tr></tbody></table></div><p>
			<i><tt>opcode</tt></i> is a symbolic constant chosen from the list above. In the explanation of the logical
			operations, <i><tt>s</tt></i> represents the incoming color index and <i><tt>d</tt></i> 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.
		</p></div><div class="refsect1" lang="en"><a name="glLogicOp.3G-notes"/><h2>Notes</h2><p>
			Color index logical operations are always supported. RGBA logical operations are supported only if the GL version is
			1.1 or greater.
		</p><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 <a href="glDrawBuffer.3G.xml">glDrawBuffer</a>).
		</p></div><div class="refsect1" lang="en"><a name="glLogicOp.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>opcode</tt></i> is not an accepted value.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glLogicOp</tt> is executed between the
			execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p></div><div class="refsect1" lang="en"><a name="glLogicOp.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_LOGIC_OP_MODE</tt>.
		</p><p>
			<a href="glIsEnabled.3G.xml"><tt>glIsEnabled</tt></a> with argument <tt>GL_COLOR_LOGIC_OP</tt> or
			<tt>GL_INDEX_LOGIC_OP</tt>.
		</p></div><div class="refsect1" lang="en"><a name="glLogicOp.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glAlphaFunc.3G.xml">glAlphaFunc</a>, <a href="glBlendFunc.3G.xml">glBlendFunc</a>, <a href="glDrawBuffer.3G.xml">glDrawBuffer</a>, <a href="glEnable.3G.xml">glEnable</a>, <a href="glStencilOp.3G.xml">glStencilOp</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glLoadName.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glMap1.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glLoadName </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glMap1</td></tr></table></div></body></html>
