Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?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" /><title>glCopyColorTable</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glCopyColorTable"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glCopyColorTable — copy pixels into a color table</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glCopyColorTable</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">internalformat</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">x</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">y</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">width</var><code>)</code>;</td></tr></table></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>target</code></em></span></dt><dd><p> | |
4 | The color table target. Must be | |
5 | <code class="constant">GL_COLOR_TABLE</code>, | |
6 | <code class="constant">GL_POST_CONVOLUTION_COLOR_TABLE</code>, | |
7 | or <code class="constant">GL_POST_COLOR_MATRIX_COLOR_TABLE</code>. | |
8 | </p></dd><dt><span class="term"><em class="parameter"><code>internalformat</code></em></span></dt><dd><p> | |
9 | The internal storage format of the texture image. | |
10 | Must be one of the following symbolic constants: | |
11 | <code class="constant">GL_ALPHA</code>, | |
12 | <code class="constant">GL_ALPHA4</code>, | |
13 | <code class="constant">GL_ALPHA8</code>, | |
14 | <code class="constant">GL_ALPHA12</code>, | |
15 | <code class="constant">GL_ALPHA16</code>, | |
16 | <code class="constant">GL_LUMINANCE</code>, | |
17 | <code class="constant">GL_LUMINANCE4</code>, | |
18 | <code class="constant">GL_LUMINANCE8</code>, | |
19 | <code class="constant">GL_LUMINANCE12</code>, | |
20 | <code class="constant">GL_LUMINANCE16</code>, | |
21 | <code class="constant">GL_LUMINANCE_ALPHA</code>, | |
22 | <code class="constant">GL_LUMINANCE4_ALPHA4</code>, | |
23 | <code class="constant">GL_LUMINANCE6_ALPHA2</code>, | |
24 | <code class="constant">GL_LUMINANCE8_ALPHA8</code>, | |
25 | <code class="constant">GL_LUMINANCE12_ALPHA4</code>, | |
26 | <code class="constant">GL_LUMINANCE12_ALPHA12</code>, | |
27 | <code class="constant">GL_LUMINANCE16_ALPHA16</code>, | |
28 | <code class="constant">GL_INTENSITY</code>, | |
29 | <code class="constant">GL_INTENSITY4</code>, | |
30 | <code class="constant">GL_INTENSITY8</code>, | |
31 | <code class="constant">GL_INTENSITY12</code>, | |
32 | <code class="constant">GL_INTENSITY16</code>, | |
33 | <code class="constant">GL_R3_G3_B2</code>, | |
34 | <code class="constant">GL_RGB</code>, | |
35 | <code class="constant">GL_RGB4</code>, | |
36 | <code class="constant">GL_RGB5</code>, | |
37 | <code class="constant">GL_RGB8</code>, | |
38 | <code class="constant">GL_RGB10</code>, | |
39 | <code class="constant">GL_RGB12</code>, | |
40 | <code class="constant">GL_RGB16</code>, | |
41 | <code class="constant">GL_RGBA</code>, | |
42 | <code class="constant">GL_RGBA2</code>, | |
43 | <code class="constant">GL_RGBA4</code>, | |
44 | <code class="constant">GL_RGB5_A1</code>, | |
45 | <code class="constant">GL_RGBA8</code>, | |
46 | <code class="constant">GL_RGB10_A2</code>, | |
47 | <code class="constant">GL_RGBA12</code>, or | |
48 | <code class="constant">GL_RGBA16</code>. | |
49 | </p></dd><dt><span class="term"><em class="parameter"><code>x</code></em></span></dt><dd><p> | |
50 | The x coordinate of the lower-left corner of the pixel rectangle | |
51 | to be transferred to the color table. | |
52 | </p></dd><dt><span class="term"><em class="parameter"><code>y</code></em></span></dt><dd><p> | |
53 | The y coordinate of the lower-left corner of the pixel rectangle | |
54 | to be transferred to the color table. | |
55 | </p></dd><dt><span class="term"><em class="parameter"><code>width</code></em></span></dt><dd><p> | |
56 | The width of the pixel rectangle. | |
57 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
58 | <code class="function">glCopyColorTable</code> loads a color table with pixels from the current | |
59 | <code class="constant">GL_READ_BUFFER</code> (rather than from main memory, as is the case for | |
60 | <a class="citerefentry" href="glColorTable.xml"><span class="citerefentry"><span class="refentrytitle">glColorTable</span></span></a>). | |
61 | </p><p> | |
62 | The screen-aligned pixel rectangle with lower-left corner at (<em class="parameter"><code>x</code></em>,\ <em class="parameter"><code>y</code></em>) | |
63 | having width <em class="parameter"><code>width</code></em> and height 1 | |
64 | is loaded into the color table. If any pixels within | |
65 | this region are outside the window that is associated with the GL | |
66 | context, the values obtained for those pixels are undefined. | |
67 | </p><p> | |
68 | The pixels in the rectangle are processed just as if | |
69 | <a class="citerefentry" href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a> were called, with <em class="parameter"><code>internalformat</code></em> set to RGBA, | |
70 | but processing stops after the final conversion to RGBA. | |
71 | </p><p> | |
72 | The four scale parameters and the four bias parameters that are defined | |
73 | for the table are then used to scale and bias the R, G, B, and A components | |
74 | of each pixel. The scale and bias parameters are set by calling | |
75 | <a class="citerefentry" href="glColorTableParameter.xml"><span class="citerefentry"><span class="refentrytitle">glColorTableParameter</span></span></a>. | |
76 | </p><p> | |
77 | Next, the R, G, B, and A values are clamped to the range | |
78 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
79 | ||
80 | <mml:mfenced open="[" close="]"> | |
81 | <mml:mn>0</mml:mn> | |
82 | <mml:mn>1</mml:mn> | |
83 | </mml:mfenced> | |
84 | </mml:math>. | |
85 | Each pixel is then converted to the internal format specified by | |
86 | <em class="parameter"><code>internalformat</code></em>. This conversion simply maps the component values of the pixel (R, G, B, | |
87 | and A) to the values included in the internal format (red, green, blue, | |
88 | alpha, luminance, and intensity). The mapping is as follows: | |
89 | </p><p> | |
90 | </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /><col align="center" /></colgroup><thead><tr><th align="left"><span class="bold"><strong> | |
91 | Internal Format | |
92 | </strong></span></th><th align="center"><span class="bold"><strong> | |
93 | Red | |
94 | </strong></span></th><th align="center"><span class="bold"><strong> | |
95 | Green | |
96 | </strong></span></th><th align="center"><span class="bold"><strong> | |
97 | Blue | |
98 | </strong></span></th><th align="center"><span class="bold"><strong> | |
99 | Alpha | |
100 | </strong></span></th><th align="center"><span class="bold"><strong> | |
101 | Luminance | |
102 | </strong></span></th><th align="center"><span class="bold"><strong> | |
103 | Intensity | |
104 | </strong></span></th></tr></thead><tbody><tr><td align="left"> | |
105 | <code class="constant">GL_ALPHA</code> | |
106 | </td><td align="center"> | |
107 | </td><td align="center"> | |
108 | </td><td align="center"> | |
109 | </td><td align="center"> | |
110 | A | |
111 | </td><td align="center"> | |
112 | </td><td align="center"> | |
113 | ||
114 | </td></tr><tr><td align="left"> | |
115 | <code class="constant">GL_LUMINANCE</code> | |
116 | </td><td align="center"> | |
117 | </td><td align="center"> | |
118 | </td><td align="center"> | |
119 | </td><td align="center"> | |
120 | </td><td align="center"> | |
121 | R | |
122 | </td><td align="center"> | |
123 | ||
124 | </td></tr><tr><td align="left"> | |
125 | <code class="constant">GL_LUMINANCE_ALPHA</code> | |
126 | </td><td align="center"> | |
127 | </td><td align="center"> | |
128 | </td><td align="center"> | |
129 | </td><td align="center"> | |
130 | A | |
131 | </td><td align="center"> | |
132 | R | |
133 | </td><td align="center"> | |
134 | ||
135 | </td></tr><tr><td align="left"> | |
136 | <code class="constant">GL_INTENSITY</code> | |
137 | </td><td align="center"> | |
138 | </td><td align="center"> | |
139 | </td><td align="center"> | |
140 | </td><td align="center"> | |
141 | </td><td align="center"> | |
142 | </td><td align="center"> | |
143 | R | |
144 | </td></tr><tr><td align="left"> | |
145 | <code class="constant">GL_RGB</code> | |
146 | </td><td align="center"> | |
147 | R | |
148 | </td><td align="center"> | |
149 | G | |
150 | </td><td align="center"> | |
151 | B | |
152 | </td><td align="center"> | |
153 | </td><td align="center"> | |
154 | </td><td align="center"> | |
155 | ||
156 | </td></tr><tr><td align="left"> | |
157 | <code class="constant">GL_RGBA</code> | |
158 | </td><td align="center"> | |
159 | R | |
160 | </td><td align="center"> | |
161 | G | |
162 | </td><td align="center"> | |
163 | B | |
164 | </td><td align="center"> | |
165 | A | |
166 | </td><td align="center"> | |
167 | </td><td align="center"> | |
168 | ||
169 | </td></tr></tbody></table></div><p> | |
170 | Finally, the red, green, blue, alpha, luminance, and/or intensity components of | |
171 | the resulting pixels are stored in the color table. | |
172 | They form a one-dimensional table with indices in the range | |
173 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
174 | ||
175 | <mml:mfenced open="[" close="]"> | |
176 | <mml:mn>0</mml:mn> | |
177 | <mml:mrow> | |
178 | <mml:mi mathvariant="italic">width</mml:mi> | |
179 | <mml:mo>-</mml:mo> | |
180 | <mml:mn>1</mml:mn> | |
181 | </mml:mrow> | |
182 | </mml:mfenced> | |
183 | </mml:math>. | |
184 | </p><p> | |
185 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
186 | <code class="function">glCopyColorTable</code> is available only if <code class="code">ARB_imaging</code> is returned from calling | |
187 | <a class="citerefentry" href="glGetString.xml"><span class="citerefentry"><span class="refentrytitle">glGetString</span></span></a> with an argument of <code class="constant">GL_EXTENSIONS</code>. | |
188 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
189 | <code class="constant">GL_INVALID_ENUM</code> is generated when <em class="parameter"><code>target</code></em> is not one of the | |
190 | allowable values. | |
191 | </p><p> | |
192 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em> is less than zero. | |
193 | </p><p> | |
194 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>internalformat</code></em> is not one of the | |
195 | allowable values. | |
196 | </p><p> | |
197 | <code class="constant">GL_TABLE_TOO_LARGE</code> is generated if the requested color table | |
198 | is too large to be supported by the implementation. | |
199 | </p><p> | |
200 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glCopyColorTable</code> is executed | |
201 | between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding | |
202 | execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>. | |
203 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
204 | <a class="citerefentry" href="glGetColorTable.xml"><span class="citerefentry"><span class="refentrytitle">glGetColorTable</span></span></a>, | |
205 | <a class="citerefentry" href="glGetColorTableParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetColorTableParameter</span></span></a> | |
206 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
207 | <a class="citerefentry" href="glColorTable.xml"><span class="citerefentry"><span class="refentrytitle">glColorTable</span></span></a>, | |
208 | <a class="citerefentry" href="glColorTableParameter.xml"><span class="citerefentry"><span class="refentrytitle">glColorTableParameter</span></span></a>, | |
209 | <a class="citerefentry" href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a> | |
210 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
211 | Copyright <span class="trademark"></span>© 1991-2006 | |
212 | Silicon Graphics, Inc. This document is licensed under the SGI | |
213 | Free Software B License. For details, see | |
214 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
215 | </p></div></div></body></html> |