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="glCopyColorTable"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glCopyColorTable</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glCopyColorTable</refname> | |
17 | <refpurpose>copy pixels into a color table</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glCopyColorTable</function></funcdef> | |
23 | <paramdef>GLenum <parameter>target</parameter></paramdef> | |
24 | <paramdef>GLenum <parameter>internalformat</parameter></paramdef> | |
25 | <paramdef>GLint <parameter>x</parameter></paramdef> | |
26 | <paramdef>GLint <parameter>y</parameter></paramdef> | |
27 | <paramdef>GLsizei <parameter>width</parameter></paramdef> | |
28 | </funcprototype> | |
29 | </funcsynopsis> | |
30 | </refsynopsisdiv> | |
31 | <!-- eqn: ignoring delim $$ --> | |
32 | <refsect1 id="parameters"><title>Parameters</title> | |
33 | <variablelist> | |
34 | <varlistentry> | |
35 | <term><parameter>target</parameter></term> | |
36 | <listitem> | |
37 | <para> | |
38 | The color table target. Must be | |
39 | <constant>GL_COLOR_TABLE</constant>, | |
40 | <constant>GL_POST_CONVOLUTION_COLOR_TABLE</constant>, | |
41 | or <constant>GL_POST_COLOR_MATRIX_COLOR_TABLE</constant>. | |
42 | </para> | |
43 | </listitem> | |
44 | </varlistentry> | |
45 | <varlistentry> | |
46 | <term><parameter>internalformat</parameter></term> | |
47 | <listitem> | |
48 | <para> | |
49 | The internal storage format of the texture image. | |
50 | Must be one of the following symbolic constants: | |
51 | <constant>GL_ALPHA</constant>, | |
52 | <constant>GL_ALPHA4</constant>, | |
53 | <constant>GL_ALPHA8</constant>, | |
54 | <constant>GL_ALPHA12</constant>, | |
55 | <constant>GL_ALPHA16</constant>, | |
56 | <constant>GL_LUMINANCE</constant>, | |
57 | <constant>GL_LUMINANCE4</constant>, | |
58 | <constant>GL_LUMINANCE8</constant>, | |
59 | <constant>GL_LUMINANCE12</constant>, | |
60 | <constant>GL_LUMINANCE16</constant>, | |
61 | <constant>GL_LUMINANCE_ALPHA</constant>, | |
62 | <constant>GL_LUMINANCE4_ALPHA4</constant>, | |
63 | <constant>GL_LUMINANCE6_ALPHA2</constant>, | |
64 | <constant>GL_LUMINANCE8_ALPHA8</constant>, | |
65 | <constant>GL_LUMINANCE12_ALPHA4</constant>, | |
66 | <constant>GL_LUMINANCE12_ALPHA12</constant>, | |
67 | <constant>GL_LUMINANCE16_ALPHA16</constant>, | |
68 | <constant>GL_INTENSITY</constant>, | |
69 | <constant>GL_INTENSITY4</constant>, | |
70 | <constant>GL_INTENSITY8</constant>, | |
71 | <constant>GL_INTENSITY12</constant>, | |
72 | <constant>GL_INTENSITY16</constant>, | |
73 | <constant>GL_R3_G3_B2</constant>, | |
74 | <constant>GL_RGB</constant>, | |
75 | <constant>GL_RGB4</constant>, | |
76 | <constant>GL_RGB5</constant>, | |
77 | <constant>GL_RGB8</constant>, | |
78 | <constant>GL_RGB10</constant>, | |
79 | <constant>GL_RGB12</constant>, | |
80 | <constant>GL_RGB16</constant>, | |
81 | <constant>GL_RGBA</constant>, | |
82 | <constant>GL_RGBA2</constant>, | |
83 | <constant>GL_RGBA4</constant>, | |
84 | <constant>GL_RGB5_A1</constant>, | |
85 | <constant>GL_RGBA8</constant>, | |
86 | <constant>GL_RGB10_A2</constant>, | |
87 | <constant>GL_RGBA12</constant>, or | |
88 | <constant>GL_RGBA16</constant>. | |
89 | </para> | |
90 | </listitem> | |
91 | </varlistentry> | |
92 | <varlistentry> | |
93 | <term><parameter>x</parameter></term> | |
94 | <listitem> | |
95 | <para> | |
96 | The x coordinate of the lower-left corner of the pixel rectangle | |
97 | to be transferred to the color table. | |
98 | </para> | |
99 | </listitem> | |
100 | </varlistentry> | |
101 | <varlistentry> | |
102 | <term><parameter>y</parameter></term> | |
103 | <listitem> | |
104 | <para> | |
105 | The y coordinate of the lower-left corner of the pixel rectangle | |
106 | to be transferred to the color table. | |
107 | </para> | |
108 | </listitem> | |
109 | </varlistentry> | |
110 | <varlistentry> | |
111 | <term><parameter>width</parameter></term> | |
112 | <listitem> | |
113 | <para> | |
114 | The width of the pixel rectangle. | |
115 | </para> | |
116 | </listitem> | |
117 | </varlistentry> | |
118 | </variablelist> | |
119 | </refsect1> | |
120 | <refsect1 id="description"><title>Description</title> | |
121 | <para> | |
122 | <function>glCopyColorTable</function> loads a color table with pixels from the current | |
123 | <constant>GL_READ_BUFFER</constant> (rather than from main memory, as is the case for | |
124 | <citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>). | |
125 | </para> | |
126 | <para> | |
127 | The screen-aligned pixel rectangle with lower-left corner at (<parameter>x</parameter>,\ <parameter>y</parameter>) | |
128 | having width <parameter>width</parameter> and height 1 | |
129 | is loaded into the color table. If any pixels within | |
130 | this region are outside the window that is associated with the GL | |
131 | context, the values obtained for those pixels are undefined. | |
132 | </para> | |
133 | <para> | |
134 | The pixels in the rectangle are processed just as if | |
135 | <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry> were called, with <parameter>internalformat</parameter> set to RGBA, | |
136 | but processing stops after the final conversion to RGBA. | |
137 | </para> | |
138 | <para> | |
139 | The four scale parameters and the four bias parameters that are defined | |
140 | for the table are then used to scale and bias the R, G, B, and A components | |
141 | of each pixel. The scale and bias parameters are set by calling | |
142 | <citerefentry><refentrytitle>glColorTableParameter</refentrytitle></citerefentry>. | |
143 | </para> | |
144 | <para> | |
145 | Next, the R, G, B, and A values are clamped to the range | |
146 | <inlineequation><mml:math> | |
147 | <!-- eqn: [0,1]:--> | |
148 | <mml:mfenced open="[" close="]"> | |
149 | <mml:mn>0</mml:mn> | |
150 | <mml:mn>1</mml:mn> | |
151 | </mml:mfenced> | |
152 | </mml:math></inlineequation>. | |
153 | Each pixel is then converted to the internal format specified by | |
154 | <parameter>internalformat</parameter>. This conversion simply maps the component values of the pixel (R, G, B, | |
155 | and A) to the values included in the internal format (red, green, blue, | |
156 | alpha, luminance, and intensity). The mapping is as follows: | |
157 | </para> | |
158 | <para> | |
159 | </para> | |
160 | <informaltable frame="topbot"> | |
161 | <tgroup cols="7" align="left"> | |
162 | <colspec colwidth="3*" /> | |
163 | <colspec colwidth="1*" align="center"/> | |
164 | <colspec colwidth="1*" align="center"/> | |
165 | <colspec colwidth="1*" align="center"/> | |
166 | <colspec colwidth="1*" align="center"/> | |
167 | <colspec colwidth="1.5*" align="center"/> | |
168 | <colspec colwidth="1.5*" align="center"/> | |
169 | <thead> | |
170 | <row> | |
171 | <entry rowsep="1" align="left"><emphasis role="bold"> | |
172 | Internal Format | |
173 | </emphasis></entry> | |
174 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
175 | Red | |
176 | </emphasis></entry> | |
177 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
178 | Green | |
179 | </emphasis></entry> | |
180 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
181 | Blue | |
182 | </emphasis></entry> | |
183 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
184 | Alpha | |
185 | </emphasis></entry> | |
186 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
187 | Luminance | |
188 | </emphasis></entry> | |
189 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
190 | Intensity | |
191 | </emphasis></entry> | |
192 | </row> | |
193 | </thead> | |
194 | <tbody> | |
195 | <row> | |
196 | <entry align="left"> | |
197 | <constant>GL_ALPHA</constant> | |
198 | </entry> | |
199 | <entry align="center"> | |
200 | </entry> | |
201 | <entry align="center"> | |
202 | </entry> | |
203 | <entry align="center"> | |
204 | </entry> | |
205 | <entry align="center"> | |
206 | A | |
207 | </entry> | |
208 | <entry align="center"> | |
209 | </entry> | |
210 | <entry align="center"> | |
211 | ||
212 | </entry> | |
213 | </row> | |
214 | <row> | |
215 | <entry align="left"> | |
216 | <constant>GL_LUMINANCE</constant> | |
217 | </entry> | |
218 | <entry align="center"> | |
219 | </entry> | |
220 | <entry align="center"> | |
221 | </entry> | |
222 | <entry align="center"> | |
223 | </entry> | |
224 | <entry align="center"> | |
225 | </entry> | |
226 | <entry align="center"> | |
227 | R | |
228 | </entry> | |
229 | <entry align="center"> | |
230 | ||
231 | </entry> | |
232 | </row> | |
233 | <row> | |
234 | <entry align="left"> | |
235 | <constant>GL_LUMINANCE_ALPHA</constant> | |
236 | </entry> | |
237 | <entry align="center"> | |
238 | </entry> | |
239 | <entry align="center"> | |
240 | </entry> | |
241 | <entry align="center"> | |
242 | </entry> | |
243 | <entry align="center"> | |
244 | A | |
245 | </entry> | |
246 | <entry align="center"> | |
247 | R | |
248 | </entry> | |
249 | <entry align="center"> | |
250 | ||
251 | </entry> | |
252 | </row> | |
253 | <row> | |
254 | <entry align="left"> | |
255 | <constant>GL_INTENSITY</constant> | |
256 | </entry> | |
257 | <entry align="center"> | |
258 | </entry> | |
259 | <entry align="center"> | |
260 | </entry> | |
261 | <entry align="center"> | |
262 | </entry> | |
263 | <entry align="center"> | |
264 | </entry> | |
265 | <entry align="center"> | |
266 | </entry> | |
267 | <entry align="center"> | |
268 | R | |
269 | </entry> | |
270 | </row> | |
271 | <row> | |
272 | <entry align="left"> | |
273 | <constant>GL_RGB</constant> | |
274 | </entry> | |
275 | <entry align="center"> | |
276 | R | |
277 | </entry> | |
278 | <entry align="center"> | |
279 | G | |
280 | </entry> | |
281 | <entry align="center"> | |
282 | B | |
283 | </entry> | |
284 | <entry align="center"> | |
285 | </entry> | |
286 | <entry align="center"> | |
287 | </entry> | |
288 | <entry align="center"> | |
289 | ||
290 | </entry> | |
291 | </row> | |
292 | <row> | |
293 | <entry align="left"> | |
294 | <constant>GL_RGBA</constant> | |
295 | </entry> | |
296 | <entry align="center"> | |
297 | R | |
298 | </entry> | |
299 | <entry align="center"> | |
300 | G | |
301 | </entry> | |
302 | <entry align="center"> | |
303 | B | |
304 | </entry> | |
305 | <entry align="center"> | |
306 | A | |
307 | </entry> | |
308 | <entry align="center"> | |
309 | </entry> | |
310 | <entry align="center"> | |
311 | ||
312 | </entry> | |
313 | </row> | |
314 | </tbody> | |
315 | </tgroup> | |
316 | </informaltable> | |
317 | <para> | |
318 | Finally, the red, green, blue, alpha, luminance, and/or intensity components of | |
319 | the resulting pixels are stored in the color table. | |
320 | They form a one-dimensional table with indices in the range | |
321 | <inlineequation><mml:math> | |
322 | <!-- eqn: [0, width-1]:--> | |
323 | <mml:mfenced open="[" close="]"> | |
324 | <mml:mn>0</mml:mn> | |
325 | <mml:mrow> | |
326 | <mml:mi mathvariant="italic">width</mml:mi> | |
327 | <mml:mo>-</mml:mo> | |
328 | <mml:mn>1</mml:mn> | |
329 | </mml:mrow> | |
330 | </mml:mfenced> | |
331 | </mml:math></inlineequation>. | |
332 | </para> | |
333 | <para> | |
334 | </para> | |
335 | </refsect1> | |
336 | <refsect1 id="notes"><title>Notes</title> | |
337 | <para> | |
338 | <function>glCopyColorTable</function> is available only if <code>ARB_imaging</code> is returned from calling | |
339 | <citerefentry><refentrytitle>glGetString</refentrytitle></citerefentry> with an argument of <constant>GL_EXTENSIONS</constant>. | |
340 | </para> | |
341 | </refsect1> | |
342 | <refsect1 id="errors"><title>Errors</title> | |
343 | <para> | |
344 | <constant>GL_INVALID_ENUM</constant> is generated when <parameter>target</parameter> is not one of the | |
345 | allowable values. | |
346 | </para> | |
347 | <para> | |
348 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> is less than zero. | |
349 | </para> | |
350 | <para> | |
351 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>internalformat</parameter> is not one of the | |
352 | allowable values. | |
353 | </para> | |
354 | <para> | |
355 | <constant>GL_TABLE_TOO_LARGE</constant> is generated if the requested color table | |
356 | is too large to be supported by the implementation. | |
357 | </para> | |
358 | <para> | |
359 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glCopyColorTable</function> is executed | |
360 | between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding | |
361 | execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
362 | </para> | |
363 | </refsect1> | |
364 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
365 | <para> | |
366 | <citerefentry><refentrytitle>glGetColorTable</refentrytitle></citerefentry>, | |
367 | <citerefentry><refentrytitle>glGetColorTableParameter</refentrytitle></citerefentry> | |
368 | </para> | |
369 | </refsect1> | |
370 | <refsect1 id="seealso"><title>See Also</title> | |
371 | <para> | |
372 | <citerefentry><refentrytitle>glColorTable</refentrytitle></citerefentry>, | |
373 | <citerefentry><refentrytitle>glColorTableParameter</refentrytitle></citerefentry>, | |
374 | <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry> | |
375 | </para> | |
376 | </refsect1> | |
377 | <refsect1 id="Copyright"><title>Copyright</title> | |
378 | <para> | |
379 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
380 | Silicon Graphics, Inc. This document is licensed under the SGI | |
381 | Free Software B License. For details, see | |
382 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
383 | </para> | |
384 | </refsect1> | |
385 | </refentry> |