rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man2 / xhtml / gluBuild2DMipmaps.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>gluBuild2DMipmaps</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="gluBuild2DMipmaps"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gluBuild2DMipmaps — builds a two-dimensional mipmap</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">gluBuild2DMipmaps</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>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 in pixels the width and height, respectively, of the texture image.
56 </p></dd><dt><span class="term"><em class="parameter"><code>format</code></em></span></dt><dd><p>
57 Specifies the format of the pixel data.
58 Must be one of
59 <code class="constant">GLU_COLOR_INDEX</code>,
60 <code class="constant">GLU_DEPTH_COMPONENT</code>,
61 <code class="constant">GLU_RED</code>,
62 <code class="constant">GLU_GREEN</code>,
63 <code class="constant">GLU_BLUE</code>,
64 <code class="constant">GLU_ALPHA</code>,
65 <code class="constant">GLU_RGB</code>,
66 <code class="constant">GLU_RGBA</code>,
67 <code class="constant">GLU_BGR</code>,
68 <code class="constant">GLU_BGRA</code>,
69 <code class="constant">GLU_LUMINANCE</code>, or
70 <code class="constant">GLU_LUMINANCE_ALPHA</code>.
71 </p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p>
72 Specifies the data type for <em class="parameter"><code>data</code></em>.
73 Must be one of
74 <code class="constant">GLU_UNSIGNED_BYTE</code>,
75 <code class="constant">GLU_BYTE</code>,
76 <code class="constant">GLU_BITMAP</code>,
77 <code class="constant">GLU_UNSIGNED_SHORT</code>,
78 <code class="constant">GLU_SHORT</code>,
79 <code class="constant">GLU_UNSIGNED_INT</code>,
80 <code class="constant">GLU_INT</code>,
81 <code class="constant">GLU_FLOAT</code>,
82 <code class="constant">GLU_UNSIGNED_BYTE_3_3_2</code>,
83 <code class="constant">GLU_UNSIGNED_BYTE_2_3_3_REV</code>,
84 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5</code>,
85 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5_REV</code>,
86 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4</code>,
87 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4_REV</code>,
88 <code class="constant">GLU_UNSIGNED_SHORT_5_5_5_1</code>,
89 <code class="constant">GLU_UNSIGNED_SHORT_1_5_5_5_REV</code>,
90 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8</code>,
91 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8_REV</code>,
92 <code class="constant">GLU_UNSIGNED_INT_10_10_10_2</code>, or
93 <code class="constant">GLU_UNSIGNED_INT_2_10_10_10_REV</code>.
94 </p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
95 Specifies a pointer to the image data in memory.
96 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
97 <code class="function">gluBuild2DMipmaps</code> builds a series of prefiltered two-dimensional texture maps of decreasing
98 resolutions called a mipmap. This is used for the antialiasing of
99 texture-mapped primitives.
100 </p><p>
101 A return value of zero indicates success, otherwise a GLU error code is
102 returned (see <a class="citerefentry" href="gluErrorString.xml"><span class="citerefentry"><span class="refentrytitle">gluErrorString</span></span></a>).
103 </p><p>
104 Initially, the <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> of <em class="parameter"><code>data</code></em> are checked to see if they
105 are a power of 2. If not, a copy of <em class="parameter"><code>data</code></em> (not <em class="parameter"><code>data</code></em>), is scaled up
106 or down to the nearest power of 2. This copy will be used for subsequent
107 mipmapping operations described below. (If <em class="parameter"><code>width</code></em> or <em class="parameter"><code>height</code></em> is exactly
108 between powers of 2, then the copy of <em class="parameter"><code>data</code></em> will scale upwards.) For
109 example, if <em class="parameter"><code>width</code></em> is 57 and <em class="parameter"><code>height</code></em> is 23, then a copy of <em class="parameter"><code>data</code></em> will
110 scale up to 64 in <em class="parameter"><code>width</code></em> and down to 16 in depth, before mipmapping takes
111 place.
112 </p><p>
113 Then, proxy textures (see <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>) are used to determine if
114 the implementation can fit the requested texture. If not, both dimensions
115 are continually halved until it fits. (If the OpenGL version is \(&lt;= 1.0,
116 both maximum texture dimensions are clamped to the value returned
117 by <a class="citerefentry" href="glGetIntegerv.xml"><span class="citerefentry"><span class="refentrytitle">glGetIntegerv</span></span></a> with the argument <code class="constant">GLU_MAX_TEXTURE_SIZE</code>.)
118 </p><p>
119 Next, a series of mipmap levels is built by decimating a copy of <em class="parameter"><code>data</code></em>
120 in half along both dimensions until size
121 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
122
123 <mml:mrow>
124 <mml:mn>1</mml:mn>
125 <mml:mo>×</mml:mo>
126 <mml:mn>1</mml:mn>
127 </mml:mrow>
128 </mml:math>
129 is reached. At
130 each level,
131 each texel in the halved mipmap level is an average of the corresponding
132 four texels in the larger mipmap level. (In the case of rectangular
133 images, the decimation will ultimately reach an
134 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
135
136 <mml:mrow>
137 <mml:mi mathvariant="italic">N</mml:mi>
138 <mml:mo>×</mml:mo>
139 <mml:mn>1</mml:mn>
140 </mml:mrow>
141 </mml:math>
142 or
143 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
144
145 <mml:mrow>
146 <mml:mn>1</mml:mn>
147 <mml:mo>×</mml:mo>
148 <mml:mi mathvariant="italic">N</mml:mi>
149 </mml:mrow>
150 </mml:math>
151 configuration. Here, two texels are averaged instead.)
152 </p><p>
153 <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a> is called to load each of these mipmap levels.
154 Level 0 is a copy of <em class="parameter"><code>data</code></em>. The highest level is
155 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
156
157 <mml:mrow>
158 <mml:mfenced open="" close="">
159 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
160 <mml:mn>2</mml:mn>
161 </mml:msub>
162 </mml:mfenced>
163 <mml:mo>⁡</mml:mo>
164 <mml:mfenced open="(" close=")">
165 <mml:mrow>
166 <mml:mi mathvariant="italic">max</mml:mi>
167 <mml:mo>⁡</mml:mo>
168 <mml:mfenced open="(" close=")">
169 <mml:mi mathvariant="italic">width</mml:mi>
170 <mml:mi mathvariant="italic">height</mml:mi>
171 </mml:mfenced>
172 </mml:mrow>
173 </mml:mfenced>
174 </mml:mrow>
175 </mml:math>.
176 For example,
177 if <em class="parameter"><code>width</code></em> is 64 and <em class="parameter"><code>height</code></em> is 16
178 and the implementation can store a texture of this size, the following
179 mipmap levels are built:
180 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
181
182 <mml:mrow>
183 <mml:mn>64</mml:mn>
184 <mml:mo>×</mml:mo>
185 <mml:mn>16</mml:mn>
186 </mml:mrow>
187 </mml:math>,
188 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
189
190 <mml:mrow>
191 <mml:mn>32</mml:mn>
192 <mml:mo>×</mml:mo>
193 <mml:mn>8</mml:mn>
194 </mml:mrow>
195 </mml:math>,
196 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
197
198 <mml:mrow>
199 <mml:mn>16</mml:mn>
200 <mml:mo>×</mml:mo>
201 <mml:mn>4</mml:mn>
202 </mml:mrow>
203 </mml:math>,
204 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
205
206 <mml:mrow>
207 <mml:mn>8</mml:mn>
208 <mml:mo>×</mml:mo>
209 <mml:mn>2</mml:mn>
210 </mml:mrow>
211 </mml:math>,
212 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
213
214 <mml:mrow>
215 <mml:mn>4</mml:mn>
216 <mml:mo>×</mml:mo>
217 <mml:mn>1</mml:mn>
218 </mml:mrow>
219 </mml:math>,
220 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
221
222 <mml:mrow>
223 <mml:mn>2</mml:mn>
224 <mml:mo>×</mml:mo>
225 <mml:mn>1</mml:mn>
226 </mml:mrow>
227 </mml:math>,
228 and
229 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
230
231 <mml:mrow>
232 <mml:mn>1</mml:mn>
233 <mml:mo>×</mml:mo>
234 <mml:mn>1</mml:mn>
235 </mml:mrow>
236 </mml:math>
237 These
238 correspond to levels 0 through 6, respectively.
239 </p><p>
240 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
241 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>
242 reference page for a description of the acceptable values
243 for <em class="parameter"><code>type</code></em> parameter.
244 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
245 Note that there is no direct way of querying the maximum level. This can
246 be derived indirectly via <a class="citerefentry" href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a>. First, query
247 for the width and height actually used at level 0. (The width and
248 height may not be equal to <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> respectively since proxy
249 textures might have scaled them to fit the implementation.) Then the
250 maximum level can be derived from the formula
251 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
252
253 <mml:mrow>
254 <mml:mfenced open="" close="">
255 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
256 <mml:mn>2</mml:mn>
257 </mml:msub>
258 </mml:mfenced>
259 <mml:mo>⁡</mml:mo>
260 <mml:mfenced open="(" close=")">
261 <mml:mrow>
262 <mml:mi mathvariant="italic">max</mml:mi>
263 <mml:mo>⁡</mml:mo>
264 <mml:mfenced open="(" close=")">
265 <mml:mi mathvariant="italic">width</mml:mi>
266 <mml:mi mathvariant="italic">height</mml:mi>
267 </mml:mfenced>
268 </mml:mrow>
269 </mml:mfenced>
270 </mml:mrow>
271 </mml:math>.
272 </p><p>
273 Formats <code class="constant">GLU_BGR</code>, and <code class="constant">GLU_BGRA</code>, and types
274 <code class="constant">GLU_UNSIGNED_BYTE_3_3_2</code>,
275 <code class="constant">GLU_UNSIGNED_BYTE_2_3_3_REV</code>,
276 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5</code>,
277 <code class="constant">GLU_UNSIGNED_SHORT_5_6_5_REV</code>,
278 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4</code>,
279 <code class="constant">GLU_UNSIGNED_SHORT_4_4_4_4_REV</code>,
280 <code class="constant">GLU_UNSIGNED_SHORT_5_5_5_1</code>,
281 <code class="constant">GLU_UNSIGNED_SHORT_1_5_5_5_REV</code>,
282 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8</code>,
283 <code class="constant">GLU_UNSIGNED_INT_8_8_8_8_REV</code>,
284 <code class="constant">GLU_UNSIGNED_INT_10_10_10_2</code>, and
285 <code class="constant">GLU_UNSIGNED_INT_2_10_10_10_REV</code> are only available if the GL version
286 is 1.2 or greater and if the GLU version is 1.3 or greater.
287 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
288 <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.
289 </p><p>
290 <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
291 legal.
292 </p><p>
293 <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>
294 and <em class="parameter"><code>format</code></em> is not <code class="constant">GLU_RGB</code>.
295 </p><p>
296 <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>
297 and <em class="parameter"><code>format</code></em> is not <code class="constant">GLU_RGB</code>.
298 </p><p>
299 <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>
300 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
301 </p><p>
302 <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>
303 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
304 </p><p>
305 <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>
306 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
307 </p><p>
308 <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>
309 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GLU_RGBA</code> nor <code class="constant">GLU_BGRA</code>.
310 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
311 <a class="citerefentry" href="gluBuild1DMipmapLevels.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild1DMipmapLevels</span></span></a>,
312 <a class="citerefentry" href="gluBuild1DMipmaps.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild1DMipmaps</span></span></a>,
313 <a class="citerefentry" href="gluBuild2DMipmapLevels.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild2DMipmapLevels</span></span></a>,
314 <a class="citerefentry" href="gluBuild3DMipmapLevels.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild3DMipmapLevels</span></span></a>,
315 <a class="citerefentry" href="gluBuild3DMipmaps.xml"><span class="citerefentry"><span class="refentrytitle">gluBuild3DMipmaps</span></span></a>,
316 <a class="citerefentry" href="gluErrorString.xml"><span class="citerefentry"><span class="refentrytitle">gluErrorString</span></span></a>,
317 <a class="citerefentry" href="glDrawPixels.xml"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>,
318 <a class="citerefentry" href="glGetTexImage.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexImage</span></span></a>,
319 <a class="citerefentry" href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a>,
320 <a class="citerefentry" href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>,
321 <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
322 <a class="citerefentry" href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>
323 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
324 Copyright <span class="trademark"></span>© 1991-2006
325 Silicon Graphics, Inc. This document is licensed under the SGI
326 Free Software B License. For details, see
327 <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
328 </p></div></div></body></html>