| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
| 3 | <!-- saved from url=(0013)about:internet --> |
| 4 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glLogicOp - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glLogicOp"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glLogicOp — specify a logical pixel operation for rendering</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><p><code class="funcdef">void <b class="fsfunc">glLogicOp</b>(</code>GLenum <var class="pdparam">opcode</var><code>)</code>;</p></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>opcode</code></em></span></dt><dd><p> |
| 5 | Specifies a symbolic constant that selects a logical operation. |
| 6 | The following symbols are accepted: |
| 7 | <code class="constant">GL_CLEAR</code>, |
| 8 | <code class="constant">GL_SET</code>, |
| 9 | <code class="constant">GL_COPY</code>, |
| 10 | <code class="constant">GL_COPY_INVERTED</code>, |
| 11 | <code class="constant">GL_NOOP</code>, |
| 12 | <code class="constant">GL_INVERT</code>, |
| 13 | <code class="constant">GL_AND</code>, |
| 14 | <code class="constant">GL_NAND</code>, |
| 15 | <code class="constant">GL_OR</code>, |
| 16 | <code class="constant">GL_NOR</code>, |
| 17 | <code class="constant">GL_XOR</code>, |
| 18 | <code class="constant">GL_EQUIV</code>, |
| 19 | <code class="constant">GL_AND_REVERSE</code>, |
| 20 | <code class="constant">GL_AND_INVERTED</code>, |
| 21 | <code class="constant">GL_OR_REVERSE</code>, and |
| 22 | <code class="constant">GL_OR_INVERTED</code>. The initial value is <code class="constant">GL_COPY</code>. |
| 23 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> |
| 24 | <code class="function">glLogicOp</code> specifies a logical operation that, |
| 25 | when enabled, |
| 26 | is applied between the incoming RGBA color |
| 27 | and the RGBA color at the corresponding location in the |
| 28 | frame buffer. |
| 29 | To enable or disable the logical operation, call |
| 30 | <a href="glEnable.xml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> and <a href="glDisable.xml"><span class="citerefentry"><span class="refentrytitle">glDisable</span></span></a> |
| 31 | using the symbolic constant <code class="constant">GL_COLOR_LOGIC_OP</code>. The initial value is |
| 32 | disabled. |
| 33 | </p><p> |
| 34 | </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left"><span class="bold"><strong> |
| 35 | Opcode |
| 36 | </strong></span></th><th align="left"><span class="bold"><strong> |
| 37 | Resulting Operation |
| 38 | </strong></span></th></tr></thead><tbody><tr><td align="left"> |
| 39 | <code class="constant">GL_CLEAR</code> |
| 40 | </td><td align="center"> |
| 41 | 0 |
| 42 | </td></tr><tr><td align="left"> |
| 43 | <code class="constant">GL_SET</code> |
| 44 | </td><td align="center"> |
| 45 | 1 |
| 46 | </td></tr><tr><td align="left"> |
| 47 | <code class="constant">GL_COPY</code> |
| 48 | </td><td align="center"> |
| 49 | s |
| 50 | </td></tr><tr><td align="left"> |
| 51 | <code class="constant">GL_COPY_INVERTED</code> |
| 52 | </td><td align="center"> |
| 53 | ~s |
| 54 | </td></tr><tr><td align="left"> |
| 55 | <code class="constant">GL_NOOP</code> |
| 56 | </td><td align="center"> |
| 57 | d |
| 58 | </td></tr><tr><td align="left"> |
| 59 | <code class="constant">GL_INVERT</code> |
| 60 | </td><td align="center"> |
| 61 | ~d |
| 62 | </td></tr><tr><td align="left"> |
| 63 | <code class="constant">GL_AND</code> |
| 64 | </td><td align="center"> |
| 65 | s & d |
| 66 | </td></tr><tr><td align="left"> |
| 67 | <code class="constant">GL_NAND</code> |
| 68 | </td><td align="center"> |
| 69 | ~(s & d) |
| 70 | </td></tr><tr><td align="left"> |
| 71 | <code class="constant">GL_OR</code> |
| 72 | </td><td align="center"> |
| 73 | s | d |
| 74 | </td></tr><tr><td align="left"> |
| 75 | <code class="constant">GL_NOR</code> |
| 76 | </td><td align="center"> |
| 77 | ~(s | d) |
| 78 | </td></tr><tr><td align="left"> |
| 79 | <code class="constant">GL_XOR</code> |
| 80 | </td><td align="center"> |
| 81 | s ^ d |
| 82 | </td></tr><tr><td align="left"> |
| 83 | <code class="constant">GL_EQUIV</code> |
| 84 | </td><td align="center"> |
| 85 | ~(s ^ d) |
| 86 | </td></tr><tr><td align="left"> |
| 87 | <code class="constant">GL_AND_REVERSE</code> |
| 88 | </td><td align="center"> |
| 89 | s & ~d |
| 90 | </td></tr><tr><td align="left"> |
| 91 | <code class="constant">GL_AND_INVERTED</code> |
| 92 | </td><td align="center"> |
| 93 | ~s & d |
| 94 | </td></tr><tr><td align="left"> |
| 95 | <code class="constant">GL_OR_REVERSE</code> |
| 96 | </td><td align="center"> |
| 97 | s | ~d |
| 98 | </td></tr><tr><td align="left"> |
| 99 | <code class="constant">GL_OR_INVERTED</code> |
| 100 | </td><td align="center"> |
| 101 | ~s | d |
| 102 | </td></tr></tbody></table></div><p> |
| 103 | <em class="parameter"><code>opcode</code></em> is a symbolic constant chosen from the list above. |
| 104 | In the explanation of the logical operations, |
| 105 | <span class="emphasis"><em>s</em></span> represents the incoming color and |
| 106 | <span class="emphasis"><em>d</em></span> represents the color in the frame buffer. |
| 107 | Standard C-language operators are used. |
| 108 | As these bitwise operators suggest, |
| 109 | the logical operation is applied independently to each bit pair of the |
| 110 | source and destination colors. |
| 111 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> |
| 112 | When more than one RGBA color buffer is enabled for drawing, |
| 113 | logical operations are performed separately for each enabled buffer, |
| 114 | using for the destination value the contents of that buffer |
| 115 | (see <a href="glDrawBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glDrawBuffer</span></span></a>). |
| 116 | </p><p> |
| 117 | Logic operations have no effect on floating point draw buffers. However, if |
| 118 | <code class="constant">GL_COLOR_LOGIC_OP</code> is enabled, blending is still disabled |
| 119 | in this case. |
| 120 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> |
| 121 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>opcode</code></em> is not an accepted value. |
| 122 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> |
| 123 | <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LOGIC_OP_MODE</code>. |
| 124 | </p><p> |
| 125 | <a href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_COLOR_LOGIC_OP</code>. |
| 126 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> |
| 127 | <a href="glBlendFunc.xml"><span class="citerefentry"><span class="refentrytitle">glBlendFunc</span></span></a>, |
| 128 | <a href="glDrawBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glDrawBuffer</span></span></a>, |
| 129 | <a href="glEnable.xml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a>, |
| 130 | <a href="glStencilOp.xml"><span class="citerefentry"><span class="refentrytitle">glStencilOp</span></span></a> |
| 131 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> |
| 132 | Copyright <span class="trademark"></span>© 1991-2006 |
| 133 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 134 | Free Software B License. For details, see |
| 135 | <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. |
| 136 | </p></div></div></body></html> |