Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> | |
4 | <refentry id="glLogicOp"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glLogicOp</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glLogicOp</refname> | |
17 | <refpurpose>specify a logical pixel operation for rendering</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glLogicOp</function></funcdef> | |
23 | <paramdef>GLenum <parameter>opcode</parameter></paramdef> | |
24 | </funcprototype> | |
25 | </funcsynopsis> | |
26 | </refsynopsisdiv> | |
27 | <refsect1 id="parameters"><title>Parameters</title> | |
28 | <variablelist> | |
29 | <varlistentry> | |
30 | <term><parameter>opcode</parameter></term> | |
31 | <listitem> | |
32 | <para> | |
33 | Specifies a symbolic constant that selects a logical operation. | |
34 | The following symbols are accepted: | |
35 | <constant>GL_CLEAR</constant>, | |
36 | <constant>GL_SET</constant>, | |
37 | <constant>GL_COPY</constant>, | |
38 | <constant>GL_COPY_INVERTED</constant>, | |
39 | <constant>GL_NOOP</constant>, | |
40 | <constant>GL_INVERT</constant>, | |
41 | <constant>GL_AND</constant>, | |
42 | <constant>GL_NAND</constant>, | |
43 | <constant>GL_OR</constant>, | |
44 | <constant>GL_NOR</constant>, | |
45 | <constant>GL_XOR</constant>, | |
46 | <constant>GL_EQUIV</constant>, | |
47 | <constant>GL_AND_REVERSE</constant>, | |
48 | <constant>GL_AND_INVERTED</constant>, | |
49 | <constant>GL_OR_REVERSE</constant>, and | |
50 | <constant>GL_OR_INVERTED</constant>. The initial value is <constant>GL_COPY</constant>. | |
51 | </para> | |
52 | </listitem> | |
53 | </varlistentry> | |
54 | </variablelist> | |
55 | </refsect1> | |
56 | <refsect1 id="description"><title>Description</title> | |
57 | <para> | |
58 | <function>glLogicOp</function> specifies a logical operation that, | |
59 | when enabled, | |
60 | is applied between the incoming RGBA color | |
61 | and the RGBA color at the corresponding location in the | |
62 | frame buffer. | |
63 | To enable or disable the logical operation, call | |
64 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry> | |
65 | using the symbolic constant <constant>GL_COLOR_LOGIC_OP</constant>. The initial value is | |
66 | disabled. | |
67 | </para> | |
68 | <para> | |
69 | </para> | |
70 | <informaltable frame="topbot"> | |
71 | <tgroup cols="2" align="left"> | |
72 | <colspec/> | |
73 | <colspec/> | |
74 | <thead> | |
75 | <row> | |
76 | <entry rowsep="1" align="left"><emphasis role="bold"> | |
77 | Opcode | |
78 | </emphasis></entry> | |
79 | <entry rowsep="1" align="left"><emphasis role="bold"> | |
80 | Resulting Operation | |
81 | </emphasis></entry> | |
82 | </row> | |
83 | </thead> | |
84 | <tbody> | |
85 | <row> | |
86 | <entry align="left"> | |
87 | <constant>GL_CLEAR</constant> | |
88 | </entry> | |
89 | <entry align="center"> | |
90 | 0 | |
91 | </entry> | |
92 | </row> | |
93 | <row> | |
94 | <entry align="left"> | |
95 | <constant>GL_SET</constant> | |
96 | </entry> | |
97 | <entry align="center"> | |
98 | 1 | |
99 | </entry> | |
100 | </row> | |
101 | <row> | |
102 | <entry align="left"> | |
103 | <constant>GL_COPY</constant> | |
104 | </entry> | |
105 | <entry align="center"> | |
106 | s | |
107 | </entry> | |
108 | </row> | |
109 | <row> | |
110 | <entry align="left"> | |
111 | <constant>GL_COPY_INVERTED</constant> | |
112 | </entry> | |
113 | <entry align="center"> | |
114 | ~s | |
115 | </entry> | |
116 | </row> | |
117 | <row> | |
118 | <entry align="left"> | |
119 | <constant>GL_NOOP</constant> | |
120 | </entry> | |
121 | <entry align="center"> | |
122 | d | |
123 | </entry> | |
124 | </row> | |
125 | <row> | |
126 | <entry align="left"> | |
127 | <constant>GL_INVERT</constant> | |
128 | </entry> | |
129 | <entry align="center"> | |
130 | ~d | |
131 | </entry> | |
132 | </row> | |
133 | <row> | |
134 | <entry align="left"> | |
135 | <constant>GL_AND</constant> | |
136 | </entry> | |
137 | <entry align="center"> | |
138 | s & d | |
139 | </entry> | |
140 | </row> | |
141 | <row> | |
142 | <entry align="left"> | |
143 | <constant>GL_NAND</constant> | |
144 | </entry> | |
145 | <entry align="center"> | |
146 | ~(s & d) | |
147 | </entry> | |
148 | </row> | |
149 | <row> | |
150 | <entry align="left"> | |
151 | <constant>GL_OR</constant> | |
152 | </entry> | |
153 | <entry align="center"> | |
154 | s | d | |
155 | </entry> | |
156 | </row> | |
157 | <row> | |
158 | <entry align="left"> | |
159 | <constant>GL_NOR</constant> | |
160 | </entry> | |
161 | <entry align="center"> | |
162 | ~(s | d) | |
163 | </entry> | |
164 | </row> | |
165 | <row> | |
166 | <entry align="left"> | |
167 | <constant>GL_XOR</constant> | |
168 | </entry> | |
169 | <entry align="center"> | |
170 | s ^ d | |
171 | </entry> | |
172 | </row> | |
173 | <row> | |
174 | <entry align="left"> | |
175 | <constant>GL_EQUIV</constant> | |
176 | </entry> | |
177 | <entry align="center"> | |
178 | ~(s ^ d) | |
179 | </entry> | |
180 | </row> | |
181 | <row> | |
182 | <entry align="left"> | |
183 | <constant>GL_AND_REVERSE</constant> | |
184 | </entry> | |
185 | <entry align="center"> | |
186 | s & ~d | |
187 | </entry> | |
188 | </row> | |
189 | <row> | |
190 | <entry align="left"> | |
191 | <constant>GL_AND_INVERTED</constant> | |
192 | </entry> | |
193 | <entry align="center"> | |
194 | ~s & d | |
195 | </entry> | |
196 | </row> | |
197 | <row> | |
198 | <entry align="left"> | |
199 | <constant>GL_OR_REVERSE</constant> | |
200 | </entry> | |
201 | <entry align="center"> | |
202 | s | ~d | |
203 | </entry> | |
204 | </row> | |
205 | <row> | |
206 | <entry align="left"> | |
207 | <constant>GL_OR_INVERTED</constant> | |
208 | </entry> | |
209 | <entry align="center"> | |
210 | ~s | d | |
211 | </entry> | |
212 | </row> | |
213 | </tbody> | |
214 | </tgroup> | |
215 | </informaltable> | |
216 | <para> | |
217 | <parameter>opcode</parameter> is a symbolic constant chosen from the list above. | |
218 | In the explanation of the logical operations, | |
219 | <emphasis>s</emphasis> represents the incoming color and | |
220 | <emphasis>d</emphasis> represents the color in the frame buffer. | |
221 | Standard C-language operators are used. | |
222 | As these bitwise operators suggest, | |
223 | the logical operation is applied independently to each bit pair of the | |
224 | source and destination colors. | |
225 | </para> | |
226 | </refsect1> | |
227 | <refsect1 id="notes"><title>Notes</title> | |
228 | <para> | |
229 | When more than one RGBA color buffer is enabled for drawing, | |
230 | logical operations are performed separately for each enabled buffer, | |
231 | using for the destination value the contents of that buffer | |
232 | (see <citerefentry><refentrytitle>glDrawBuffer</refentrytitle></citerefentry>). | |
233 | </para> | |
234 | <para> | |
235 | Logic operations have no effect on floating point draw buffers. However, if | |
236 | <constant>GL_COLOR_LOGIC_OP</constant> is enabled, blending is still disabled | |
237 | in this case. | |
238 | </para> | |
239 | </refsect1> | |
240 | <refsect1 id="errors"><title>Errors</title> | |
241 | <para> | |
242 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>opcode</parameter> is not an accepted value. | |
243 | </para> | |
244 | </refsect1> | |
245 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
246 | <para> | |
247 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LOGIC_OP_MODE</constant>. | |
248 | </para> | |
249 | <para> | |
250 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_COLOR_LOGIC_OP</constant>. | |
251 | </para> | |
252 | </refsect1> | |
253 | <refsect1 id="seealso"><title>See Also</title> | |
254 | <para> | |
255 | <citerefentry><refentrytitle>glBlendFunc</refentrytitle></citerefentry>, | |
256 | <citerefentry><refentrytitle>glDrawBuffer</refentrytitle></citerefentry>, | |
257 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>, | |
258 | <citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry> | |
259 | </para> | |
260 | </refsect1> | |
261 | <refsect1 id="Copyright"><title>Copyright</title> | |
262 | <para> | |
263 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
264 | Silicon Graphics, Inc. This document is licensed under the SGI | |
265 | Free Software B License. For details, see | |
266 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
267 | </para> | |
268 | </refsect1> | |
269 | </refentry> |