rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man2 / xhtml / gluBuild2DMipmapLevels.xml
CommitLineData
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>gluBuild2DMipmapLevels</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="gluBuild2DMipmapLevels"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gluBuild2DMipmapLevels — builds a subset of two-dimensional mipmap levels</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">GLint <b class="fsfunc">gluBuild2DMipmapLevels</b>(</code></td><td>GLenum  </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">internalFormat</var>, </td></tr><tr><td> </td><td>GLsizei  </td><td><var class="pdparam">width</var>, </td></tr><tr><td> </td><td>GLsizei  </td><td><var class="pdparam">height</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">format</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">type</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">level</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">base</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">max</var>, </td></tr><tr><td> </td><td>const void *  </td><td><var class="pdparam">data</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 Specifies the target texture. Must be <code class="constant">GLU_TEXTURE_2D</code>.
5 </p></dd><dt><span class="term"><em class="parameter"><code>internalFormat</code></em></span></dt><dd><p>
6 Requests the internal storage format of the texture image. The most
7 current version of the SGI implementation of GLU does not check this
8 value for validity before passing it on to the underlying OpenGL
9 implementation. A value that is not accepted by the OpenGL
10 implementation will lead to an OpenGL error. The benefit of not
11 checking this value at the GLU level is that OpenGL extensions can add
12 new internal texture formats without requiring a revision of the GLU
13 implementation. Older implementations of GLU check this value and
14 raise a GLU error if it is not 1, 2, 3, or 4 or one of the following
15 symbolic constants:
16 <code class="constant">GLU_ALPHA</code>,
17 <code class="constant">GLU_ALPHA4</code>,
18 <code class="constant">GLU_ALPHA8</code>,
19 <code class="constant">GLU_ALPHA12</code>,
20 <code class="constant">GLU_ALPHA16</code>,
21 <code class="constant">GLU_LUMINANCE</code>,
22 <code class="constant">GLU_LUMINANCE4</code>,
23 <code class="constant">GLU_LUMINANCE8</code>,
24 <code class="constant">GLU_LUMINANCE12</code>,
25 <code class="constant">GLU_LUMINANCE16</code>,
26 <code class="constant">GLU_LUMINANCE_ALPHA</code>,
27 <code class="constant">GLU_LUMINANCE4_ALPHA4</code>,
28 <code class="constant">GLU_LUMINANCE6_ALPHA2</code>,
29 <code class="constant">GLU_LUMINANCE8_ALPHA8</code>,
30 <code class="constant">GLU_LUMINANCE12_ALPHA4</code>,
31 <code class="constant">GLU_LUMINANCE12_ALPHA12</code>,
32 <code class="constant">GLU_LUMINANCE16_ALPHA16</code>,
33 <code class="constant">GLU_INTENSITY</code>,
34 <code class="constant">GLU_INTENSITY4</code>,
35 <code class="constant">GLU_INTENSITY8</code>,
36 <code class="constant">GLU_INTENSITY12</code>,
37 <code class="constant">GLU_INTENSITY16</code>,
38 <code class="constant">GLU_RGB</code>,
39 <code class="constant">GLU_R3_G3_B2</code>,
40 <code class="constant">GLU_RGB4</code>,
41 <code class="constant">GLU_RGB5</code>,
42 <code class="constant">GLU_RGB8</code>,
43 <code class="constant">GLU_RGB10</code>,
44 <code class="constant">GLU_RGB12</code>,
45 <code class="constant">GLU_RGB16</code>,
46 <code class="constant">GLU_RGBA</code>,
47 <code class="constant">GLU_RGBA2</code>,
48 <code class="constant">GLU_RGBA4</code>,
49 <code class="constant">GLU_RGB5_A1</code>,
50 <code class="constant">GLU_RGBA8</code>,
51 <code class="constant">GLU_RGB10_A2</code>,
52 <code class="constant">GLU_RGBA12</code>, or
53 <code class="constant">GLU_RGBA16</code>.
54 </p></dd><dt><span class="term"><em class="parameter"><code>width</code></em>, </span><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p>
55 Specifies the width and height, respectively, in pixels of the texture image.
56 These should be a power of 2.
57 </p></dd><dt><span class="term"><em class="parameter"><code>format</code></em></span></dt><dd><p>
58 Specifies the format of the pixel data.
59 Must be one of
60 <code class="constant">GLU_COLOR_INDEX</code>,
61 <code class="constant">GLU_DEPTH_COMPONENT</code>,
62 <code class="constant">GLU_RED</code>,
63 <code class="constant">GLU_GREEN</code>,
64 <code class="constant">GLU_BLUE</code>,
65 <code class="constant">GLU_ALPHA</code>,
66 <code class="constant">GLU_RGB</code>,
67 <code class="constant">GLU_RGBA</code>,
68 <code class="constant">GLU_BGR</code>,
69 <code class="constant">GLU_BGRA</code>,
70 <code class="constant">GLU_LUMINANCE</code>, or
71 <code class="constant">GLU_LUMINANCE_ALPHA</code>.
72 </p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p>
73 Specifies the data type for <em class="parameter"><code>data</code></em>.
74 Must be one of
75 <code class="constant">GLU_UNSIGNED_BYTE</code>,
76 <code class="constant">GLU_BYTE</code>,
77 <code class="constant">GLU_BITMAP</code>,
78 <code class="constant">GLU_UNSIGNED_SHORT</code>,
79 <code class="constant">GLU_SHORT</code>,
80 <code class="constant">GLU_UNSIGNED_INT</code>,
81 <code class="constant">GLU_INT</code>,
82 <code class="constant">GLU_FLOAT</code>,
83 <code class="constant">GLU_UNSIGNED_BYTE_3_3_2</code>,
84 <code class="constant">GLU_UNSIGNED_BYTE_2_3_3_REV</code>,
85 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5</code>,
86 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5_REV</code>,
87 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4</code>,
88 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4_REV</code>,
89 <code class="constant">GLU_UNSIGNED_SHORT_5_5_5_1</code>,
90 <code class="constant">GLU_UNSIGNED_SHORT_1_5_5_5_REV</code>,
91 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8</code>,
92 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8_REV</code>,
93 <code class="constant">GLU_UNSIGNED_INT_10_10_10_2</code>, or
94 <code class="constant">GLU_UNSIGNED_INT_2_10_10_10_REV</code>.
95 </p></dd><dt><span class="term"><em class="parameter"><code>level</code></em></span></dt><dd><p>
96 Specifies the mipmap level of the image data.
97 </p></dd><dt><span class="term"><em class="parameter"><code>base</code></em></span></dt><dd><p>
98 Specifies the minimum mipmap level to pass to <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>.
99 </p></dd><dt><span class="term"><em class="parameter"><code>max</code></em></span></dt><dd><p>
100 Specifies the maximum mipmap level to pass to <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>.
101 </p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
102 Specifies a pointer to the image data in memory.
103 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
104 <code class="function">gluBuild2DMipmapLevels</code> builds a subset of prefiltered two-dimensional texture maps of decreasing
105 resolutions called a mipmap. This is used for the antialiasing of
106 texture mapped primitives.
107 </p><p>
108 A return value of zero indicates success, otherwise a GLU error code is
109 returned (see <a class="citerefentry" href="gluErrorString.xml"><span class="citerefentry"><span class="refentrytitle">gluErrorString</span></span></a>).
110 </p><p>
111 A series of mipmap levels from <em class="parameter"><code>base</code></em> to <em class="parameter"><code>max</code></em> is built by decimating
112 <em class="parameter"><code>data</code></em> in half along
113 both dimensions until size
114 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
115
116 <mml:mrow>
117 <mml:mn>1</mml:mn>
118 <mml:mo>×</mml:mo>
119 <mml:mn>1</mml:mn>
120 </mml:mrow>
121 </mml:math>
122 is reached. At each level, each texel in the
123 halved mipmap level is an average of the corresponding four texels in the larger
124 mipmap level. (In the case of rectangular images, the decimation will ultimately
125 reach an
126 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
127
128 <mml:mrow>
129 <mml:mi mathvariant="italic">N</mml:mi>
130 <mml:mo>×</mml:mo>
131 <mml:mn>1</mml:mn>
132 </mml:mrow>
133 </mml:math>
134 or
135 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
136
137 <mml:mrow>
138 <mml:mn>1</mml:mn>
139 <mml:mo>×</mml:mo>
140 <mml:mi mathvariant="italic">N</mml:mi>
141 </mml:mrow>
142 </mml:math>
143 configuration. Here, two texels are
144 averaged instead.)
145 <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a> is called to load these mipmap levels from <em class="parameter"><code>base</code></em>
146 to <em class="parameter"><code>max</code></em>. If <em class="parameter"><code>max</code></em> is larger than the highest mipmap level for the
147 texture of the specified size, then a GLU error code is returned (see
148 <a class="citerefentry" href="gluErrorString.xml"><span class="citerefentry"><span class="refentrytitle">gluErrorString</span></span></a>) and nothing is loaded.
149 </p><p>
150 For example, if <em class="parameter"><code>level</code></em> is 2 and <em class="parameter"><code>width</code></em> is 16 and <em class="parameter"><code>height</code></em> is 8, the
151 following levels are possible:
152 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
153
154 <mml:mrow>
155 <mml:mn>16</mml:mn>
156 <mml:mo>×</mml:mo>
157 <mml:mn>8</mml:mn>
158 </mml:mrow>
159 </mml:math>,
160 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
161
162 <mml:mrow>
163 <mml:mn>8</mml:mn>
164 <mml:mo>×</mml:mo>
165 <mml:mn>4</mml:mn>
166 </mml:mrow>
167 </mml:math>,
168 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
169
170 <mml:mrow>
171 <mml:mn>4</mml:mn>
172 <mml:mo>×</mml:mo>
173 <mml:mn>2</mml:mn>
174 </mml:mrow>
175 </mml:math>,
176 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
177
178 <mml:mrow>
179 <mml:mn>2</mml:mn>
180 <mml:mo>×</mml:mo>
181 <mml:mn>1</mml:mn>
182 </mml:mrow>
183 </mml:math>,
184 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
185
186 <mml:mrow>
187 <mml:mn>1</mml:mn>
188 <mml:mo>×</mml:mo>
189 <mml:mn>1</mml:mn>
190 </mml:mrow>
191 </mml:math>.
192 These correspond to levels 2 through 6
193 respectively. If <em class="parameter"><code>base</code></em> is 3 and <em class="parameter"><code>max</code></em> is 5, then only mipmap levels
194 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
195
196 <mml:mrow>
197 <mml:mn>8</mml:mn>
198 <mml:mo>×</mml:mo>
199 <mml:mn>4</mml:mn>
200 </mml:mrow>
201 </mml:math>,
202 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
203
204 <mml:mrow>
205 <mml:mn>4</mml:mn>
206 <mml:mo>×</mml:mo>
207 <mml:mn>2</mml:mn>
208 </mml:mrow>
209 </mml:math>,
210 and
211 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
212
213 <mml:mrow>
214 <mml:mn>2</mml:mn>
215 <mml:mo>×</mml:mo>
216 <mml:mn>1</mml:mn>
217 </mml:mrow>
218 </mml:math>
219 are loaded. However, if <em class="parameter"><code>max</code></em>
220 is 7, then an error is returned and nothing is loaded since <em class="parameter"><code>max</code></em> is
221 larger than the highest mipmap level which is, in this case, 6.
222 </p><p>
223 The highest mipmap level can be derived from the formula
224 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
225
226 <mml:mrow>
227 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
228 <mml:mn>2</mml:mn>
229 </mml:msub>
230 <mml:mo>⁡</mml:mo>
231 <mml:mfenced open="(" close=")">
232 <mml:mrow>
233 <mml:mrow>
234 <mml:mi mathvariant="italic">max</mml:mi>
235 <mml:mo>⁡</mml:mo>
236 <mml:mfenced open="(" close=")">
237 <mml:mi mathvariant="italic">width</mml:mi>
238 <mml:mi mathvariant="italic">height</mml:mi>
239 </mml:mfenced>
240 </mml:mrow>
241 <mml:mo>×</mml:mo>
242 <mml:msup><mml:mn>2</mml:mn>
243 <mml:mi mathvariant="italic">level</mml:mi>
244 </mml:msup>
245 </mml:mrow>
246 </mml:mfenced>
247 </mml:mrow>
248 </mml:math>.
249 </p><p>
250 See the <a class="citerefentry" href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a> reference page for a description of the
251 acceptable values for <em class="parameter"><code>format</code></em> parameter. See the <a class="citerefentry" href="glDrawPixels.xml"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>
252 reference page for a description of the acceptable values
253 for <em class="parameter"><code>type</code></em> parameter.
254 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
255 <code class="function">gluBuild2DMipmapLevels</code> is only available if the GLU version is 1.3 or greater.
256 </p><p>
257 Formats <code class="constant">GLU_BGR</code>, and <code class="constant">GLU_BGRA</code>, and types
258 <code class="constant">GLU_UNSIGNED_BYTE_3_3_2</code>,
259 <code class="constant">GLU_UNSIGNED_BYTE_2_3_3_REV</code>,
260 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5</code>,
261 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5_REV</code>,
262 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4</code>,
263 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4_REV</code>,
264 <code class="constant">GLU_UNSIGNED_SHORT_5_5_5_1</code>,
265 <code class="constant">GLU_UNSIGNED_SHORT_1_5_5_5_REV</code>,
266 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8</code>,
267 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8_REV</code>,
268 <code class="constant">GLU_UNSIGNED_INT_10_10_10_2</code>, and
269 <code class="constant">GLU_UNSIGNED_INT_2_10_10_10_REV</code> are only available if the GL version
270 is 1.2 or greater.
271 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
272 <code class="constant">GLU_INVALID_VALUE</code> is returned if <em class="parameter"><code>level</code></em> &gt; <em class="parameter"><code>base</code></em>, <em class="parameter"><code>base</code></em> &lt; 0,
273 <em class="parameter"><code>max</code></em> &lt; <em class="parameter"><code>base</code></em>, or <em class="parameter"><code>max</code></em> is &gt; the highest mipmap level for <em class="parameter"><code>data</code></em>.
274 </p><p>
275 <code class="constant">GLU_INVALID_VALUE</code> is returned if <em class="parameter"><code>width</code></em> or <em class="parameter"><code>height</code></em> is &lt; 1.
276 </p><p>
277 <code class="constant">GLU_INVALID_ENUM</code> is returned if <em class="parameter"><code>internalFormat</code></em>, <em class="parameter"><code>format</code></em>, or <em class="parameter"><code>type</code></em> is not
278 legal.
279 </p><p>
280 <code class="constant">GLU_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is <code class="constant">GLU_UNSIGNED_BYTE_3_3_2</code> or <code class="constant">GLU_UNSIGNED_BYTE_2_3_3_REV</code>
281 and <em class="parameter"><code>format</code></em> is not <code class="constant">GLU_RGB</code>.
282 </p><p>
283 <code class="constant">GLU_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is <code class="constant">GLU_UNSIGNED_SHORT_5_6_5</code> or <code class="constant">GLU_UNSIGNED_SHORT_5_6_5_REV</code>
284 and <em class="parameter"><code>format</code></em> is not <code class="constant">GLU_RGB</code>.
285 </p><p>
286 <code class="constant">GLU_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4</code> or <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4_REV</code>
287 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
288 </p><p>
289 <code class="constant">GLU_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is <code class="constant">GLU_UNSIGNED_SHORT_5_5_5_1</code> or <code class="constant">GLU_UNSIGNED_SHORT_1_5_5_5_REV</code>
290 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
291 </p><p>
292 <code class="constant">GLU_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is <code class="constant">GLU_UNSIGNED_INT_8_8_8_8</code> or <code class="constant">GLU_UNSIGNED_INT_8_8_8_8_REV</code>
293 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
294 </p><p>
295 <code class="constant">GLU_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is <code class="constant">GLU_UNSIGNED_INT_10_10_10_2</code> or <code class="constant">GLU_UNSIGNED_INT_2_10_10_10_REV</code>
296 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
297 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
298 <a class="citerefentry" href="gluBuild1DMipmapLevels.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild1DMipmapLevels</span></span></a>,
299 <a class="citerefentry" href="gluBuild1DMipmaps.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild1DMipmaps</span></span></a>,
300 <a class="citerefentry" href="gluBuild2DMipmaps.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild2DMipmaps</span></span></a>,
301 <a class="citerefentry" href="gluBuild3DMipmapLevels.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild3DMipmapLevels</span></span></a>,
302 <a class="citerefentry" href="gluBuild3DMipmaps.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild3DMipmaps</span></span></a>,
303 <a class="citerefentry" href="gluErrorString.xml"><span class="citerefentry"><span class="refentrytitle">gluErrorString</span></span></a>,
304 <a class="citerefentry" href="glDrawPixels.xml"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>,
305 <a class="citerefentry" href="glGetTexImage.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexImage</span></span></a>,
306 <a class="citerefentry" href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a>,
307 <a class="citerefentry" href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>,
308 <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
309 <a class="citerefentry" href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>
310 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
311 Copyright <span class="trademark"></span>© 1991-2006
312 Silicon Graphics, Inc. This document is licensed under the SGI
313 Free Software B License. For details, see
314 <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
315 </p></div></div></body></html>