1GLUBUILD2DMIPMAPLEVELS(3G) GLUBUILD2DMIPMAPLEVELS(3G)
2
3
4
6 gluBuild2DMipmapLevels - builds a subset of two-dimensional mipmap lev‐
7 els
8
9
11 GLint gluBuild2DMipmapLevels( GLenum target,
12 GLint internalFormat,
13 GLsizei width,
14 GLsizei height,
15 GLenum format,
16 GLenum type,
17 GLint level,
18 GLint base,
19 GLint max,
20 const void *data )
21
22
24 target Specifies the target texture. Must be GL_TEXTURE_2D.
25
26 internalFormat Requests the internal storage of the texture image.
27 The most current version of the SGI implementation of
28 GLU does not check this value for validity before pass‐
29 ing it on to the underlying OpenGL implementation. A
30 value that is not accepted by the OpenGL implementation
31 will lead to an OpenGL error. The benefit of not
32 checking this value at the GLU level is that OpenGL
33 extensions can add new internal texture formats without
34 requiring a revision of the GLU implementation. Older
35 implementations of GLU check this value and raise a GLU
36 error if it is not 1, 2, 3, or 4 or one of the follow‐
37 ing symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8,
38 GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4,
39 GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16,
40 GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4,
41 GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8,
42 GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12,
43 GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4,
44 GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_RGB,
45 GL_R3_G3_B2, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10,
46 GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4,
47 GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12 or
48 GL_RGBA16.
49
50 width, height Specifies the width and height, respectively, in pixels
51 of the texture image. These should be a power of 2.
52
53 format Specifies the of the pixel data. Must be one of
54 GL_COLOR_INDEX, GL_DEPTH_COMPONENT, GL_RED, GL_GREEN,
55 GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA, GL_BGR, GL_BGRA,
56 GL_LUMINANCE, or GL_LUMINANCE_ALPHA.
57
58 type Specifies the data type for data. Must be one of
59 GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP,
60 GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT,
61 GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2,
62 GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5,
63 GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4,
64 GL_UNSIGNED_SHORT_4_4_4_4_REV,
65 GL_UNSIGNED_SHORT_5_5_5_1,
66 GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8,
67 GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2
68 or GL_UNSIGNED_INT_2_10_10_10_REV.
69
70 level Specifies the mipmap level of the image data.
71
72 base Specifies the minimum mipmap level to pass to glTexIm‐
73 age2D.
74
75 max Specifies the maximum mipmap level to pass to glTexIm‐
76 age2D.
77
78 data Specifies a pointer to the image data in memory.
79
81 gluBuild2DMipmapLevels builds a subset of prefiltered two-dimensional
82 texture maps of decreasing resolutions called a mipmap. This is used
83 for the antialiasing of texture mapped primitives.
84
85 A return value of zero indicates success, otherwise a GLU error code is
86 returned (see gluErrorString).
87
88 A series of mipmap levels from base to max is built by decimating data
89 in half along both dimensions until size 1×1 is reached. At each level,
90 each texel in the halved mipmap level is an average of the correspond‐
91 ing four texels in the larger mipmap level. (In the case of rectangular
92 images, the decimation will ultimately reach an N×1 or 1×N configura‐
93 tion. Here, two texels are averaged instead.) glTexImage2D is called
94 to load these mipmap levels from base to max. If max is larger than the
95 highest mipmap level for the texture of the specified size, then a GLU
96 error code is returned (see gluErrorString) and nothing is loaded.
97
98 For example, if level is 2 and width is 16 and height is 8, the follow‐
99 ing levels are possible: 16×8, 8×4, 4×2, 2×1, 1×1. These correspond to
100 levels 2 through 6 respectively. If base is 3 and max is 5, then only
101 mipmap levels 8×4, 4×2 and 2×1 are loaded. However, if max is 7 then an
102 error is returned and nothing is loaded since max is larger than the
103 highest mipmap level which is, in this case, 6.
104
105 The highest mipmap level can be derived from the formula
106 log2(max(width,height)*(2^level)).
107
108 See the glTexImage1D reference page for a description of the acceptable
109 values for format parameter. See the glDrawPixels reference page for a
110 description of the acceptable values for type parameter.
111
113 gluBuild2DMipmapLevels is only available if the GLU version is 1.3 or
114 greater.
115
116 Formats GL_BGR, and GL_BGRA, and types GL_UNSIGNED_BYTE_3_3_2,
117 GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5,
118 GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4,
119 GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1,
120 GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8,
121 GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, and
122 GL_UNSIGNED_INT_2_10_10_10_REV are only available if the GL version is
123 1.2 or greater.
124
126 GLU_INVALID_VALUE is returned if level > base, base < 0, max < base or
127 max is > the highest mipmap level for data.
128
129 GLU_INVALID_VALUE is returned if width or height is < 1.
130
131 GLU_INVALID_ENUM is returned if internalFormat, format, or type is not
132 legal.
133
134 GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_BYTE_3_3_2 or
135 GL_UNSIGNED_BYTE_2_3_3_REV and format is not GL_RGB.
136
137 GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_SHORT_5_6_5 or
138 GL_UNSIGNED_SHORT_5_6_5_REV and format is not GL_RGB.
139
140 GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_SHORT_4_4_4_4
141 or GL_UNSIGNED_SHORT_4_4_4_4_REV and format is neither GL_RGBA nor
142 GL_BGRA.
143
144 GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_SHORT_5_5_5_1
145 or GL_UNSIGNED_SHORT_1_5_5_5_REV and format is neither GL_RGBA nor
146 GL_BGRA.
147
148 GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_INT_8_8_8_8 or
149 GL_UNSIGNED_INT_8_8_8_8_REV and format is neither GL_RGBA nor GL_BGRA.
150
151 GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_INT_10_10_10_2
152 or GL_UNSIGNED_INT_2_10_10_10_REV and format is neither GL_RGBA nor
153 GL_BGRA.
154
156 glDrawPixels(3G), glTexImage1D(3G), glTexImage2D(3G), glTexImage3D(3G),
157 gluBuild1DMipmaps(3G), gluBuild2DMipmaps(3G), gluBuild3DMipmaps(3G),
158 gluErrorString(3G), glGetTexImage(3G), glGetTexLevelParameter(3G),
159 gluBuild1DMipmapLevels(3G), gluBuild3DMipmapLevels(3G)
160
161
162
163 GLUBUILD2DMIPMAPLEVELS(3G)