rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man2 / gluBuild3DMipmaps.xml
CommitLineData
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="gluBuild3DMipmaps">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>1991-2006</year>
9 <holder>Silicon Graphics, Inc.</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>gluBuild3DMipmaps</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>gluBuild3DMipmaps</refname>
17 <refpurpose>builds a three-dimensional mipmap</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>GLint <function>gluBuild3DMipmaps</function></funcdef>
23 <paramdef>GLenum <parameter>target</parameter></paramdef>
24 <paramdef>GLint <parameter>internalFormat</parameter></paramdef>
25 <paramdef>GLsizei <parameter>width</parameter></paramdef>
26 <paramdef>GLsizei <parameter>height</parameter></paramdef>
27 <paramdef>GLsizei <parameter>depth</parameter></paramdef>
28 <paramdef>GLenum <parameter>format</parameter></paramdef>
29 <paramdef>GLenum <parameter>type</parameter></paramdef>
30 <paramdef>const void * <parameter>data</parameter></paramdef>
31 </funcprototype>
32 </funcsynopsis>
33 </refsynopsisdiv>
34 <!-- eqn: ignoring delim $$ -->
35 <refsect1 id="parameters"><title>Parameters</title>
36 <variablelist>
37 <varlistentry>
38 <term><parameter>target</parameter></term>
39 <listitem>
40 <para>
41 Specifies the target texture. Must be <constant>GLU_TEXTURE_3D</constant>.
42 </para>
43 </listitem>
44 </varlistentry>
45 <varlistentry>
46 <term><parameter>internalFormat</parameter></term>
47 <listitem>
48 <para>
49 Requests the internal storage format of the texture image. The most
50 current version of the SGI implementation of GLU does not check this
51 value for validity before passing it on to the underlying OpenGL
52 implementation. A value that is not accepted by the OpenGL
53 implementation will lead to an OpenGL error. The benefit of not
54 checking this value at the GLU level is that OpenGL extensions can add
55 new internal texture formats without requiring a revision of the GLU
56 implementation. Older implementations of GLU check this value and
57 raise a GLU error if it is not 1, 2, 3, or 4 or one of the following
58 symbolic constants:
59 <constant>GLU_ALPHA</constant>,
60 <constant>GLU_ALPHA4</constant>,
61 <constant>GLU_ALPHA8</constant>,
62 <constant>GLU_ALPHA12</constant>,
63 <constant>GLU_ALPHA16</constant>,
64 <constant>GLU_LUMINANCE</constant>,
65 <constant>GLU_LUMINANCE4</constant>,
66 <constant>GLU_LUMINANCE8</constant>,
67 <constant>GLU_LUMINANCE12</constant>,
68 <constant>GLU_LUMINANCE16</constant>,
69 <constant>GLU_LUMINANCE_ALPHA</constant>,
70 <constant>GLU_LUMINANCE4_ALPHA4</constant>,
71 <constant>GLU_LUMINANCE6_ALPHA2</constant>,
72 <constant>GLU_LUMINANCE8_ALPHA8</constant>,
73 <constant>GLU_LUMINANCE12_ALPHA4</constant>,
74 <constant>GLU_LUMINANCE12_ALPHA12</constant>,
75 <constant>GLU_LUMINANCE16_ALPHA16</constant>,
76 <constant>GLU_INTENSITY</constant>,
77 <constant>GLU_INTENSITY4</constant>,
78 <constant>GLU_INTENSITY8</constant>,
79 <constant>GLU_INTENSITY12</constant>,
80 <constant>GLU_INTENSITY16</constant>,
81 <constant>GLU_RGB</constant>,
82 <constant>GLU_R3_G3_B2</constant>,
83 <constant>GLU_RGB4</constant>,
84 <constant>GLU_RGB5</constant>,
85 <constant>GLU_RGB8</constant>,
86 <constant>GLU_RGB10</constant>,
87 <constant>GLU_RGB12</constant>,
88 <constant>GLU_RGB16</constant>,
89 <constant>GLU_RGBA</constant>,
90 <constant>GLU_RGBA2</constant>,
91 <constant>GLU_RGBA4</constant>,
92 <constant>GLU_RGB5_A1</constant>,
93 <constant>GLU_RGBA8</constant>,
94 <constant>GLU_RGB10_A2</constant>,
95 <constant>GLU_RGBA12</constant>, or
96 <constant>GLU_RGBA16</constant>.
97 </para>
98 </listitem>
99 </varlistentry>
100 <varlistentry>
101 <term><parameter>width</parameter></term>
102 <term><parameter>height</parameter></term>
103 <term><parameter>depth</parameter></term>
104 <listitem>
105 <para>
106 Specifies in pixels the width, height and depth respectively, in pixels
107 of the texture image.
108 </para>
109 </listitem>
110 </varlistentry>
111 <varlistentry>
112 <term><parameter>format</parameter></term>
113 <listitem>
114 <para>
115 Specifies the format of the pixel data.
116 Must be one of
117 <constant>GLU_COLOR_INDEX</constant>,
118 <constant>GLU_DEPTH_COMPONENT</constant>,
119 <constant>GLU_RED</constant>,
120 <constant>GLU_GREEN</constant>,
121 <constant>GLU_BLUE</constant>,
122 <constant>GLU_ALPHA</constant>,
123 <constant>GLU_RGB</constant>,
124 <constant>GLU_RGBA</constant>,
125 <constant>GLU_BGR</constant>,
126 <constant>GLU_BGRA</constant>,
127 <constant>GLU_LUMINANCE</constant>, or
128 <constant>GLU_LUMINANCE_ALPHA</constant>.
129 </para>
130 </listitem>
131 </varlistentry>
132 <varlistentry>
133 <term><parameter>type</parameter></term>
134 <listitem>
135 <para>
136 Specifies the data type for <parameter>data</parameter>.
137 Must be one of:
138 <constant>GLU_UNSIGNED_BYTE</constant>,
139 <constant>GLU_BYTE</constant>,
140 <constant>GLU_BITMAP</constant>,
141 <constant>GLU_UNSIGNED_SHORT</constant>,
142 <constant>GLU_SHORT</constant>,
143 <constant>GLU_UNSIGNED_INT</constant>,
144 <constant>GLU_INT</constant>,
145 <constant>GLU_FLOAT</constant>,
146 <constant>GLU_UNSIGNED_BYTE_3_3_2</constant>,
147 <constant>GLU_UNSIGNED_BYTE_2_3_3_REV</constant>,
148 <constant>GLU_UNSIGNED_SHORT_5_6_5</constant>,
149 <constant>GLU_UNSIGNED_SHORT_5_6_5_REV</constant>,
150 <constant>GLU_UNSIGNED_SHORT_4_4_4_4</constant>,
151 <constant>GLU_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
152 <constant>GLU_UNSIGNED_SHORT_5_5_5_1</constant>,
153 <constant>GLU_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
154 <constant>GLU_UNSIGNED_INT_8_8_8_8</constant>,
155 <constant>GLU_UNSIGNED_INT_8_8_8_8_REV</constant>,
156 <constant>GLU_UNSIGNED_INT_10_10_10_2</constant>, or
157 <constant>GLU_UNSIGNED_INT_2_10_10_10_REV</constant>.
158 </para>
159 </listitem>
160 </varlistentry>
161 <varlistentry>
162 <term><parameter>data</parameter></term>
163 <listitem>
164 <para>
165 Specifies a pointer to the image data in memory.
166 </para>
167 </listitem>
168 </varlistentry>
169 </variablelist>
170 </refsect1>
171 <refsect1 id="description"><title>Description</title>
172 <para>
173 <function>gluBuild3DMipmaps</function> builds a series of prefiltered three-dimensional texture maps of
174 decreasing resolutions called a mipmap. This is used for the antialiasing of
175 texture-mapped primitives.
176 </para>
177 <para>
178 A return value of zero indicates success, otherwise a GLU error code is
179 returned (see <citerefentry><refentrytitle>gluErrorString</refentrytitle></citerefentry>).
180 </para>
181 <para>
182 Initially, the <parameter>width</parameter>, <parameter>height</parameter> and <parameter>depth</parameter> of <parameter>data</parameter> are checked to
183 see if they are a power of 2. If not, a copy of <parameter>data</parameter> is made and
184 scaled up or down to the nearest power of 2. (If <parameter>width</parameter>, <parameter>height</parameter>, or
185 <parameter>depth</parameter> is exactly between powers of 2, then the copy of <parameter>data</parameter> will
186 scale upwards.) This copy will be used for subsequent mipmapping
187 operations described below. For example, if <parameter>width</parameter> is 57, <parameter>height</parameter> is
188 23, and <parameter>depth</parameter> is 24, then a copy of <parameter>data</parameter> will scale up to 64 in
189 width, down to 16 in height, and up to 32 in depth before mipmapping
190 takes place.
191 </para>
192 <para>
193 Then, proxy textures (see <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>) are used to determine if
194 the implementation can fit the requested texture. If not, all three dimensions
195 are continually halved until it fits.
196 </para>
197 <para>
198 Next, a series of mipmap levels is built by decimating a copy of <parameter>data</parameter>
199 in half along all three dimensions until size
200 <inlineequation><mml:math>
201 <!-- eqn: 1 times 1 times 1:-->
202 <mml:mrow>
203 <mml:mn>1</mml:mn>
204 <mml:mo>&times;</mml:mo>
205 <mml:mn>1</mml:mn>
206 <mml:mo>&times;</mml:mo>
207 <mml:mn>1</mml:mn>
208 </mml:mrow>
209 </mml:math></inlineequation>
210 is
211 reached. At each level, each texel in the halved mipmap level is an
212 average of the corresponding eight texels in the larger mipmap
213 level. (If exactly one of the dimensions is 1, four texels are averaged.
214 If exactly two of the dimensions are 1, two texels are averaged.)
215 </para>
216 <para>
217 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry> is called to load each of these mipmap levels.
218 Level 0 is a copy of <parameter>data</parameter>. The highest level is
219 <inlineequation><mml:math>
220 <!-- eqn: {log sub 2} ( max (width,height,depth)):-->
221 <mml:mrow>
222 <mml:mfenced open="" close="">
223 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
224 <mml:mn>2</mml:mn>
225 </mml:msub>
226 </mml:mfenced>
227 <mml:mo>&af;</mml:mo>
228 <mml:mfenced open="(" close=")">
229 <mml:mrow>
230 <mml:mi mathvariant="italic">max</mml:mi>
231 <mml:mo>&af;</mml:mo>
232 <mml:mfenced open="(" close=")">
233 <mml:mi mathvariant="italic">width</mml:mi>
234 <mml:mi mathvariant="italic">height</mml:mi>
235 <mml:mi mathvariant="italic">depth</mml:mi>
236 </mml:mfenced>
237 </mml:mrow>
238 </mml:mfenced>
239 </mml:mrow>
240 </mml:math></inlineequation>.
241 For example, if <parameter>width</parameter> is 64, <parameter>height</parameter> is
242 16, and <parameter>depth</parameter> is 32, and the implementation can store a texture of this
243 size, the following mipmap levels are built:
244 <inlineequation><mml:math>
245 <!-- eqn: 64 times 16 times 32:-->
246 <mml:mrow>
247 <mml:mn>64</mml:mn>
248 <mml:mo>&times;</mml:mo>
249 <mml:mn>16</mml:mn>
250 <mml:mo>&times;</mml:mo>
251 <mml:mn>32</mml:mn>
252 </mml:mrow>
253 </mml:math></inlineequation>,
254 <inlineequation><mml:math>
255 <!-- eqn: 32 times 8 times 16:-->
256 <mml:mrow>
257 <mml:mn>32</mml:mn>
258 <mml:mo>&times;</mml:mo>
259 <mml:mn>8</mml:mn>
260 <mml:mo>&times;</mml:mo>
261 <mml:mn>16</mml:mn>
262 </mml:mrow>
263 </mml:math></inlineequation>,
264 <inlineequation><mml:math>
265 <!-- eqn: 16 times 4 times 8:-->
266 <mml:mrow>
267 <mml:mn>16</mml:mn>
268 <mml:mo>&times;</mml:mo>
269 <mml:mn>4</mml:mn>
270 <mml:mo>&times;</mml:mo>
271 <mml:mn>8</mml:mn>
272 </mml:mrow>
273 </mml:math></inlineequation>,
274 <inlineequation><mml:math>
275 <!-- eqn: 8 times 2 times 4:-->
276 <mml:mrow>
277 <mml:mn>8</mml:mn>
278 <mml:mo>&times;</mml:mo>
279 <mml:mn>2</mml:mn>
280 <mml:mo>&times;</mml:mo>
281 <mml:mn>4</mml:mn>
282 </mml:mrow>
283 </mml:math></inlineequation>,
284 <inlineequation><mml:math>
285 <!-- eqn: 4 times 1 times 2:-->
286 <mml:mrow>
287 <mml:mn>4</mml:mn>
288 <mml:mo>&times;</mml:mo>
289 <mml:mn>1</mml:mn>
290 <mml:mo>&times;</mml:mo>
291 <mml:mn>2</mml:mn>
292 </mml:mrow>
293 </mml:math></inlineequation>,
294 <inlineequation><mml:math>
295 <!-- eqn: 2 times 1 times 1:-->
296 <mml:mrow>
297 <mml:mn>2</mml:mn>
298 <mml:mo>&times;</mml:mo>
299 <mml:mn>1</mml:mn>
300 <mml:mo>&times;</mml:mo>
301 <mml:mn>1</mml:mn>
302 </mml:mrow>
303 </mml:math></inlineequation>,
304 and
305 <inlineequation><mml:math>
306 <!-- eqn: 1 times 1 times 1:-->
307 <mml:mrow>
308 <mml:mn>1</mml:mn>
309 <mml:mo>&times;</mml:mo>
310 <mml:mn>1</mml:mn>
311 <mml:mo>&times;</mml:mo>
312 <mml:mn>1</mml:mn>
313 </mml:mrow>
314 </mml:math></inlineequation>.
315 These correspond
316 to levels 0 through 6, respectively.
317 </para>
318 <para>
319 See the <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry> reference page for a description of the
320 acceptable values for <parameter>format</parameter> parameter. See the <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>
321 reference page for a description of the acceptable values
322 for <parameter>type</parameter> parameter.
323 </para>
324 </refsect1>
325 <refsect1 id="notes"><title>Notes</title>
326 <para>
327 Note that there is no direct way of querying the maximum level. This can
328 be derived indirectly via <citerefentry><refentrytitle>glGetTexLevelParameter</refentrytitle></citerefentry>. First, query
329 the width, height, and depth actually used at level 0. (The width,
330 height, and depth may not be equal to <parameter>width</parameter>, <parameter>height</parameter>, and <parameter>depth</parameter>
331 respectively since proxy textures might have scaled them to fit the
332 implementation.) Then the maximum level can be derived from the formula
333 <inlineequation><mml:math>
334 <!-- eqn: {log sub 2} ( max (width,height,depth)):-->
335 <mml:mrow>
336 <mml:mfenced open="" close="">
337 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
338 <mml:mn>2</mml:mn>
339 </mml:msub>
340 </mml:mfenced>
341 <mml:mo>&af;</mml:mo>
342 <mml:mfenced open="(" close=")">
343 <mml:mrow>
344 <mml:mi mathvariant="italic">max</mml:mi>
345 <mml:mo>&af;</mml:mo>
346 <mml:mfenced open="(" close=")">
347 <mml:mi mathvariant="italic">width</mml:mi>
348 <mml:mi mathvariant="italic">height</mml:mi>
349 <mml:mi mathvariant="italic">depth</mml:mi>
350 </mml:mfenced>
351 </mml:mrow>
352 </mml:mfenced>
353 </mml:mrow>
354 </mml:math></inlineequation>.
355 </para>
356 <para>
357 <function>gluBuild3DMipmaps</function> is only available if the GLU version is 1.3 or greater.
358 </para>
359 <para>
360 Formats <constant>GLU_BGR</constant>, and <constant>GLU_BGRA</constant>, and types
361 <constant>GLU_UNSIGNED_BYTE_3_3_2</constant>,
362 <constant>GLU_UNSIGNED_BYTE_2_3_3_REV</constant>,
363 <constant>GLU_UNSIGNED_SHORT_5_6_5</constant>,
364 <constant>GLU_UNSIGNED_SHORT_5_6_5_REV</constant>,
365 <constant>GLU_UNSIGNED_SHORT_4_4_4_4</constant>,
366 <constant>GLU_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
367 <constant>GLU_UNSIGNED_SHORT_5_5_5_1</constant>,
368 <constant>GLU_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
369 <constant>GLU_UNSIGNED_INT_8_8_8_8</constant>,
370 <constant>GLU_UNSIGNED_INT_8_8_8_8_REV</constant>,
371 <constant>GLU_UNSIGNED_INT_10_10_10_2</constant>, and
372 <constant>GLU_UNSIGNED_INT_2_10_10_10_REV</constant> are only available if the GL version
373 is 1.2 or greater.
374 </para>
375 </refsect1>
376 <refsect1 id="errors"><title>Errors</title>
377 <para>
378 <constant>GLU_INVALID_VALUE</constant> is returned if <parameter>width</parameter>, <parameter>height</parameter>, or <parameter>depth</parameter> is &lt; 1.
379 </para>
380 <para>
381 <constant>GLU_INVALID_ENUM</constant> is returned if <parameter>internalFormat</parameter>, <parameter>format</parameter>, or <parameter>type</parameter> is not
382 legal.
383 </para>
384 <para>
385 <constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_BYTE_3_3_2</constant> or <constant>GLU_UNSIGNED_BYTE_2_3_3_REV</constant>
386 and <parameter>format</parameter> is not <constant>GLU_RGB</constant>.
387 </para>
388 <para>
389 <constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_SHORT_5_6_5</constant> or <constant>GLU_UNSIGNED_SHORT_5_6_5_REV</constant>
390 and <parameter>format</parameter> is not <constant>GLU_RGB</constant>.
391 </para>
392 <para>
393 <constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_SHORT_4_4_4_4</constant> or <constant>GLU_UNSIGNED_SHORT_4_4_4_4_REV</constant>
394 and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
395 </para>
396 <para>
397 <constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_SHORT_5_5_5_1</constant> or <constant>GLU_UNSIGNED_SHORT_1_5_5_5_REV</constant>
398 and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
399 </para>
400 <para>
401 <constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_INT_8_8_8_8</constant> or <constant>GLU_UNSIGNED_INT_8_8_8_8_REV</constant>
402 and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
403 </para>
404 <para>
405 <constant>GLU_INVALID_OPERATION</constant> is returned if <parameter>type</parameter> is <constant>GLU_UNSIGNED_INT_10_10_10_2</constant> or <constant>GLU_UNSIGNED_INT_2_10_10_10_REV</constant>
406 and <parameter>format</parameter> is neither <constant>GLU_RGBA</constant> nor <constant>GLU_BGRA</constant>.
407 </para>
408 </refsect1>
409 <refsect1 id="seealso"><title>See Also</title>
410 <para>
411 <citerefentry><refentrytitle>gluBuild1DMipmapLevels</refentrytitle></citerefentry>,
412 <citerefentry><refentrytitle>gluBuild1DMipmaps</refentrytitle></citerefentry>,
413 <citerefentry><refentrytitle>gluBuild2DMipmapLevels</refentrytitle></citerefentry>,
414 <citerefentry><refentrytitle>gluBuild3DMipmapLevels</refentrytitle></citerefentry>,
415 <function>gluBuild3DMipmaps</function>,
416 <citerefentry><refentrytitle>gluErrorString</refentrytitle></citerefentry>,
417 <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>,
418 <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>,
419 <citerefentry><refentrytitle>glGetTexLevelParameter</refentrytitle></citerefentry>,
420 <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
421 <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
422 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>
423 </para>
424 </refsect1>
425 <refsect1 id="Copyright"><title>Copyright</title>
426 <para>
427 Copyright <trademark class="copyright"></trademark> 1991-2006
428 Silicon Graphics, Inc. This document is licensed under the SGI
429 Free Software B License. For details, see
430 <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
431 </para>
432 </refsect1>
433</refentry>