1GLUBUILD3DMIPMAPS(3G)                                    GLUBUILD3DMIPMAPS(3G)
2
3
4

NAME

6       gluBuild3DMipmaps - builds a three-dimensional mipmap
7
8

C SPECIFICATION

10       GLint gluBuild3DMipmaps( GLenum target,
11                                GLint internalFormat,
12                                GLsizei width,
13                                GLsizei height,
14                                GLsizei depth,
15                                GLenum format,
16                                GLenum type,
17                                const void *data )
18
19

PARAMETERS

21       target          Specifies the target texture.  Must be GL_TEXTURE_3D.
22
23       internalFormat  Requests  the  internal  storage  of the texture image.
24                       The most current version of the SGI  implementation  of
25                       GLU does not check this value for validity before pass‐
26                       ing it on to the underlying OpenGL  implementation.   A
27                       value that is not accepted by the OpenGL implementation
28                       will lead to an  OpenGL  error.   The  benefit  of  not
29                       checking  this  value  at  the GLU level is that OpenGL
30                       extensions can add new internal texture formats without
31                       requiring  a revision of the GLU implementation.  Older
32                       implementations of GLU check this value and raise a GLU
33                       error  if it is not 1, 2, 3, or 4 or one of the follow‐
34                       ing symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8,
35                       GL_ALPHA12,  GL_ALPHA16,  GL_LUMINANCE,  GL_LUMINANCE4,
36                       GL_LUMINANCE8,     GL_LUMINANCE12,      GL_LUMINANCE16,
37                       GL_LUMINANCE_ALPHA,               GL_LUMINANCE4_ALPHA4,
38                       GL_LUMINANCE6_ALPHA2,             GL_LUMINANCE8_ALPHA8,
39                       GL_LUMINANCE12_ALPHA4,          GL_LUMINANCE12_ALPHA12,
40                       GL_LUMINANCE16_ALPHA16,  GL_INTENSITY,   GL_INTENSITY4,
41                       GL_INTENSITY8,  GL_INTENSITY12, GL_INTENSITY16, GL_RGB,
42                       GL_R3_G3_B2,  GL_RGB4,  GL_RGB5,   GL_RGB8,   GL_RGB10,
43                       GL_RGB12,   GL_RGB16,   GL_RGBA,   GL_RGBA2,  GL_RGBA4,
44                       GL_RGB5_A1,  GL_RGBA8,   GL_RGB10_A2,   GL_RGBA12,   or
45                       GL_RGBA16.
46
47       width, height, depth
48                       Specifies in pixels the width, height and depth respec‐
49                       tively, in pixels of the texture image.
50
51       format          Specifies the  of the  pixel  data.   Must  be  one  of
52                       GL_COLOR_INDEX,  GL_DEPTH_COMPONENT,  GL_RED, GL_GREEN,
53                       GL_BLUE, GL_ALPHA, GL_RGB,  GL_RGBA,  GL_BGR,  GL_BGRA,
54                       GL_LUMINANCE, or GL_LUMINANCE_ALPHA.
55
56       type            Specifies  the  data  type  for  data.  Must be one of:
57                       GL_UNSIGNED_BYTE,          GL_BYTE,          GL_BITMAP,
58                       GL_UNSIGNED_SHORT,  GL_SHORT,  GL_UNSIGNED_INT, GL_INT,
59                       GL_FLOAT,                       GL_UNSIGNED_BYTE_3_3_2,
60                       GL_UNSIGNED_BYTE_2_3_3_REV,    GL_UNSIGNED_SHORT_5_6_5,
61                       GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4,
62                       GL_UNSIGNED_SHORT_4_4_4_4_REV,
63                       GL_UNSIGNED_SHORT_5_5_5_1,
64                       GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8,
65                       GL_UNSIGNED_INT_8_8_8_8_REV,
66                       GL_UNSIGNED_INT_10_10_10_2,                          or
67                       GL_UNSIGNED_INT_2_10_10_10_REV.
68
69       data            Specifies a pointer to the image data in memory.
70

DESCRIPTION

72       gluBuild3DMipmaps builds a series of prefiltered three-dimensional tex‐
73       ture  maps  of decreasing resolutions called a mipmap. This is used for
74       the antialiasing of texture-mapped primitives.
75
76       A return value of zero indicates success, otherwise a GLU error code is
77       returned (see gluErrorString).
78
79       Initially,  the  width,  height and depth of data are checked to see if
80       they are a power of 2. If not, a copy of data (not data), is scaled  up
81       or  down  to  the  nearest  power  of  2. (If width, height or depth is
82       exactly between powers of 2, then the copy of data will scale upwards.)
83       This  copy  will be used for subsequent mipmapping operations described
84       below.  For example, if width is 57, height is 23 and depth is 24  then
85       a  copy  of data will scale up to 64 in width, down to 16 in height and
86       up to 32 in depth, before mipmapping takes place.
87
88       Then, proxy textures (see glTexImage3D) are used to  determine  if  the
89       implementation  can fit the requested texture. If not, all three dimen‐
90       sions are continually halved until it fits.
91
92       Next, a series of mipmap levels is built by decimating a copy  of  data
93       in half along all three 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.)
98
99       glTexImage3D is called to load each of these mipmap levels.  Level 0 is
100       a copy of data.  The highest  level  is  log2(max(width,height,depth)).
101       For  example,  if  width  is  64, height is 16 and depth is 32, and the
102       implementation can store a texture of this size, the  following  mipmap
103       levels  are  built:  64×16×32, 32×8×16, 16×4×8, 8×2×4, 4×1×2, 2×1×1 and
104       1×1×1. These correspond to levels 0 through 6, respectively.
105
106       See the glTexImage1D reference page for a description of the acceptable
107       values  for format parameter. See the glDrawPixels reference page for a
108       description of the acceptable values for type parameter.
109

NOTES

111       Note that there is no direct way of querying the  maximum  level.  This
112       can  be derived indirectly via glGetTexLevelParameter. First, query for
113       the width, height and depth actually used  at  level  0.   (The  width,
114       height  and  depth  may not be equal to width, height and depth respec‐
115       tively since proxy textures might have scaled them to fit the implemen‐
116       tation.)   Then  the  maximum  level  can  be  derived from the formula
117       log2(max(width,height,depth)).
118
119       gluBuild3DMipmaps is only available  if  the  GLU  version  is  1.3  or
120       greater.
121
122       Formats   GL_BGR,   and   GL_BGRA,  and  types  GL_UNSIGNED_BYTE_3_3_2,
123       GL_UNSIGNED_BYTE_2_3_3_REV,                    GL_UNSIGNED_SHORT_5_6_5,
124       GL_UNSIGNED_SHORT_5_6_5_REV,                 GL_UNSIGNED_SHORT_4_4_4_4,
125       GL_UNSIGNED_SHORT_4_4_4_4_REV,               GL_UNSIGNED_SHORT_5_5_5_1,
126       GL_UNSIGNED_SHORT_1_5_5_5_REV,                 GL_UNSIGNED_INT_8_8_8_8,
127       GL_UNSIGNED_INT_8_8_8_8_REV,      GL_UNSIGNED_INT_10_10_10_2,       and
128       GL_UNSIGNED_INT_2_10_10_10_REV  are only available if the GL version is
129       1.2 or greater.
130

ERRORS

132       GLU_INVALID_VALUE is returned if width, height, or depth is < 1.
133
134       GLU_INVALID_ENUM is returned if internalFormat, format, or type is  not
135       legal.
136
137       GLU_INVALID_OPERATION  is returned if type is GL_UNSIGNED_BYTE_3_3_2 or
138       GL_UNSIGNED_BYTE_2_3_3_REV and format is not GL_RGB.
139
140       GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_SHORT_5_6_5 or
141       GL_UNSIGNED_SHORT_5_6_5_REV and format is not GL_RGB.
142
143       GLU_INVALID_OPERATION  is returned if type is GL_UNSIGNED_SHORT_4_4_4_4
144       or GL_UNSIGNED_SHORT_4_4_4_4_REV and  format  is  neither  GL_RGBA  nor
145       GL_BGRA.
146
147       GLU_INVALID_OPERATION  is returned if type is GL_UNSIGNED_SHORT_5_5_5_1
148       or GL_UNSIGNED_SHORT_1_5_5_5_REV and  format  is  neither  GL_RGBA  nor
149       GL_BGRA.
150
151       GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_INT_8_8_8_8 or
152       GL_UNSIGNED_INT_8_8_8_8_REV and format is neither GL_RGBA nor GL_BGRA.
153
154       GLU_INVALID_OPERATION is returned if type is GL_UNSIGNED_INT_10_10_10_2
155       or  GL_UNSIGNED_INT_2_10_10_10_REV  and  format  is neither GL_RGBA nor
156       GL_BGRA.
157

SEE ALSO

159       glDrawPixels(3G), glTexImage1D(3G), glTexImage2D(3G), glTexImage3D(3G),
160       gluBuild1DMipmaps(3G),    gluBuild3DMipmaps(3G),    gluErrorString(3G),
161       glGetTexImage(3G),                          glGetTexLevelParameter(3G),
162       gluBuild1DMipmapLevels(3G),                 gluBuild2DMipmapLevels(3G),
163       gluBuild3DMipmapLevels(3G)
164
165
166
167                                                         GLUBUILD3DMIPMAPS(3G)
Impressum