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