summaryrefslogtreecommitdiff
path: root/doc/gl-docs/GLU/build2dmipmaplevels.3gl
blob: 37cdf02b4832da062eefa7a31a6024e059123994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
'\" e
'\"! eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 6 March 1997
.ds Re Release 1.2.0
.ds Dp May 02 11:53
.ds Dm 37 build2dmi
.ds Xs 35570 9 build2dmipmaplevels.gl
.TH GLUBUILD2DMIPMAPLEVELS 3G
.SH NAME
.B "gluBuild2DMipmapLevels
\- builds a subset of two-dimensional mipmap levels

.SH C SPECIFICATION
GLint \f3gluBuild2DMipmapLevels\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3GLint \fPgluBuild2DMipmapLevels( 'u
	GLint \fIinternalFormat\fP,
	GLsizei \fIwidth\fP,
	GLsizei \fIheight\fP,
	GLenum \fIformat\fP,
	GLenum \fItype\fP,
	GLint \fIlevel\fP,
	GLint \fIbase\fP,
	GLint \fImax\fP,
	const void \fI*data\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIinternalFormat\fP\ \ 'u 
\f2target\fP
Specifies the target texture.  Must be \%\f3GL_TEXTURE_2D\fP.
.TP
\f2internalFormat\fP
Requests the internal storage  of the texture image.  The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation.  A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error.  The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation.  Older implementations of GLU check this value and
raise a GLU error if it is not 1, 2, 3, or 4 or one of the following
symbolic constants:
\%\f3GL_ALPHA\fP,
\%\f3GL_ALPHA4\fP,
\%\f3GL_ALPHA8\fP,
\%\f3GL_ALPHA12\fP,
\%\f3GL_ALPHA16\fP,
\%\f3GL_LUMINANCE\fP,
\%\f3GL_LUMINANCE4\fP,
\%\f3GL_LUMINANCE8\fP,
\%\f3GL_LUMINANCE12\fP,
\%\f3GL_LUMINANCE16\fP,
\%\f3GL_LUMINANCE_ALPHA\fP,
\%\f3GL_LUMINANCE4_ALPHA4\fP,
\%\f3GL_LUMINANCE6_ALPHA2\fP,
\%\f3GL_LUMINANCE8_ALPHA8\fP,
\%\f3GL_LUMINANCE12_ALPHA4\fP,
\%\f3GL_LUMINANCE12_ALPHA12\fP,
\%\f3GL_LUMINANCE16_ALPHA16\fP,
\%\f3GL_INTENSITY\fP,
\%\f3GL_INTENSITY4\fP,
\%\f3GL_INTENSITY8\fP,
\%\f3GL_INTENSITY12\fP,
\%\f3GL_INTENSITY16\fP,
\%\f3GL_RGB\fP,
\%\f3GL_R3_G3_B2\fP,
\%\f3GL_RGB4\fP,
\%\f3GL_RGB5\fP,
\%\f3GL_RGB8\fP,
\%\f3GL_RGB10\fP,
\%\f3GL_RGB12\fP,
\%\f3GL_RGB16\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_RGBA2\fP,
\%\f3GL_RGBA4\fP,
\%\f3GL_RGB5_A1\fP,
\%\f3GL_RGBA8\fP,
\%\f3GL_RGB10_A2\fP,
\%\f3GL_RGBA12\fP or
\%\f3GL_RGBA16\fP.
.TP
\f2width\fP, \f2height\fP
Specifies the width and height, respectively, in pixels of the texture image. 
These should be a power of 2.
.TP
\f2format\fP
Specifies the  of the pixel data.
Must be one of
\%\f3GL_COLOR_INDEX\fP,
\%\f3GL_DEPTH_COMPONENT\fP,
\%\f3GL_RED\fP,
\%\f3GL_GREEN\fP,
\%\f3GL_BLUE\fP,
\%\f3GL_ALPHA\fP,
\%\f3GL_RGB\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_BGR\fP,
\%\f3GL_BGRA\fP,
\%\f3GL_LUMINANCE\fP, or
\%\f3GL_LUMINANCE_ALPHA\fP.
.TP
\f2type\fP
Specifies the data type for \f2data\fP.
Must be one of
\%\f3GL_UNSIGNED_BYTE\fP,
\%\f3GL_BYTE\fP,
\%\f3GL_BITMAP\fP,
\%\f3GL_UNSIGNED_SHORT\fP,
\%\f3GL_SHORT\fP,
\%\f3GL_UNSIGNED_INT\fP,
\%\f3GL_INT\fP, 
\%\f3GL_FLOAT\fP, 
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP or
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP.
.TP
\f2level\fP
Specifies the mipmap level of the image data.
.TP
\f2base\fP
Specifies the minimum mipmap level to pass to \f3glTexImage2D\fP.
.TP
\f2max\fP
Specifies the maximum mipmap level to pass to \f3glTexImage2D\fP.
.TP
\f2data\fP
Specifies a pointer to the image data in memory.
.SH DESCRIPTION
\%\f3gluBuild2DMipmapLevels\fP builds a subset of prefiltered two-dimensional texture maps of decreasing
resolutions called a mipmap. This is used for the antialiasing of
texture mapped primitives.
.P
A return value of zero indicates success, otherwise a GLU error code is
returned (see \%\f3gluErrorString\fP).
.P
A series of mipmap levels from \f2base\fP to \f2max\fP is built by decimating 
\f2data\fP in half along
both dimensions until size $1 ~times~ 1$ is reached. At each level, each texel in the
halved mipmap level is an average of the corresponding four texels in the larger
mipmap level. (In the case of rectangular images, the decimation will ultimately 
reach an $N ~times~ 1$ or $1 ~times~ N$ configuration. Here, two texels are
averaged instead.)
\f3glTexImage2D\fP is called to load these mipmap levels from \f2base\fP
to \f2max\fP. If \f2max\fP is larger than the highest mipmap level for the
texture of the specified size, then a GLU error code is returned (see
\%\f3gluErrorString\fP) and nothing is loaded.
.P
For example, if \f2level\fP is 2 and \f2width\fP is 16 and \f2height\fP is 8, the
following levels are possible: $16 ~times~ 8$, $8 ~times~ 4$, $4 ~times~ 2$,
$2 ~times~ 1$, $1 ~times~ 1$. These correspond to levels 2 through 6
respectively.  If \f2base\fP is 3 and \f2max\fP is 5, then only mipmap levels
$8 ~times~ 4$, $4 ~times~ 2$ and $2 ~times~ 1$ are loaded. However, if \f2max\fP
is 7 then an error is returned and nothing is loaded since \f2max\fP is
larger than the highest mipmap level which is, in this case, 6.
.P
The highest mipmap level can be derived from the formula
log2(max(\f2width\fP,\f2height\fP)*(2^\f2level\fP)).
.P
See the \f3glTexImage1D\fP reference page for a description of the
acceptable values for \f2format\fP parameter. See the \f3glDrawPixels\fP 
reference page for a description of the acceptable values 
for \f2type\fP parameter.
.SH NOTES
\%\f3gluBuild2DMipmapLevels\fP is only available if the GLU version is 1.3 or greater.
.P
Formats \%\f3GL_BGR\fP, and \%\f3GL_BGRA\fP, and types 
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, and
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP are only available if the GL version 
is 1.2 or greater.
.SH ERRORS
\%\f3GLU_INVALID_VALUE\fP is returned if \f2level\fP > \f2base\fP, \f2base\fP < 0,
\f2max\fP < \f2base\fP or \f2max\fP is > the highest mipmap level for \f2data\fP.
.P
\%\f3GLU_INVALID_VALUE\fP is returned if \f2width\fP or \f2height\fP is < 1.
.P
\%\f3GLU_INVALID_ENUM\fP is returned if \f2internalFormat\fP, \f2format\fP, or \f2type\fP is not 
legal.
.P
\%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_BYTE_3_3_2\fP or \%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP
and \f2format\fP is not \%\f3GL_RGB\fP.
.P
\%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_SHORT_5_6_5\fP or \%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP
and \f2format\fP is not \%\f3GL_RGB\fP.
.P
\%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP or \%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP
and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
.P
\%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP or \%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP
and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
.P
\%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_INT_8_8_8_8\fP or \%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP
and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
.P
\%\f3GLU_INVALID_OPERATION\fP is returned if \f2type\fP is \%\f3GL_UNSIGNED_INT_10_10_10_2\fP or \%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP
and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
.SH SEE ALSO
\f3glDrawPixels(3G)\fP,
\f3glTexImage1D(3G)\fP,
\f3glTexImage2D(3G)\fP, 
\f3glTexImage3D(3G)\fP,
\%\f3gluBuild1DMipmaps(3G)\fP,
\%\f3gluBuild2DMipmaps(3G)\fP,
\%\f3gluBuild3DMipmaps(3G)\fP, 
\%\f3gluErrorString(3G)\fP, 
\f3glGetTexImage(3G)\fP,
\f3glGetTexLevelParameter(3G)\fP,
\%\f3gluBuild1DMipmapLevels(3G)\fP,
\%\f3gluBuild3DMipmapLevels(3G)\fP