1GLUBUILD1DMIPMAPS(3G) OpenGL Manual GLUBUILD1DMIPMAPS(3G)
2
3
4
6 gluBuild1DMipmaps - builds a one-dimensional mipmap
7
9 GLint gluBuild1DMipmaps(GLenum target, GLint internalFormat,
10 GLsizei width, GLenum format, GLenum type,
11 const void * data);
12
14 target
15 Specifies the target texture. Must be GLU_TEXTURE_1D.
16
17 internalFormat
18 Requests the internal storage format of the texture image. The most
19 current version of the SGI implementation of GLU does not check
20 this value for validity before passing it on to the underlying
21 OpenGL implementation. A value that is not accepted by the OpenGL
22 implementation will lead to an OpenGL error. The benefit of not
23 checking this value at the GLU level is that OpenGL extensions can
24 add new internal texture formats without requiring a revision of
25 the GLU implementation. Older implementations of GLU check this
26 value and raise a GLU error if it is not 1, 2, 3, or 4 or one of
27 the following symbolic constants: GLU_ALPHA, GLU_ALPHA4,
28 GLU_ALPHA8, GLU_ALPHA12, GLU_ALPHA16, GLU_LUMINANCE,
29 GLU_LUMINANCE4, GLU_LUMINANCE8, GLU_LUMINANCE12, GLU_LUMINANCE16,
30 GLU_LUMINANCE_ALPHA, GLU_LUMINANCE4_ALPHA4, GLU_LUMINANCE6_ALPHA2,
31 GLU_LUMINANCE8_ALPHA8, GLU_LUMINANCE12_ALPHA4,
32 GLU_LUMINANCE12_ALPHA12, GLU_LUMINANCE16_ALPHA16, GLU_INTENSITY,
33 GLU_INTENSITY4, GLU_INTENSITY8, GLU_INTENSITY12, GLU_INTENSITY16,
34 GLU_RGB, GLU_R3_G3_B2, GLU_RGB4, GLU_RGB5, GLU_RGB8, GLU_RGB10,
35 GLU_RGB12, GLU_RGB16, GLU_RGBA, GLU_RGBA2, GLU_RGBA4, GLU_RGB5_A1,
36 GLU_RGBA8, GLU_RGB10_A2, GLU_RGBA12, or GLU_RGBA16.
37
38 width
39 Specifies the width, in pixels, of the texture image.
40
41 format
42 Specifies the format of the pixel data. Must be one of
43 GLU_COLOR_INDEX, GLU_DEPTH_COMPONENT, GLU_RED, GLU_GREEN, GLU_BLUE,
44 GLU_ALPHA, GLU_RGB, GLU_RGBA, GLU_BGR, GLU_BGRA, GLU_LUMINANCE, or
45 GLU_LUMINANCE_ALPHA.
46
47 type
48 Specifies the data type for data. Must be one of GLU_UNSIGNED_BYTE,
49 GLU_BYTE, GLU_BITMAP, GLU_UNSIGNED_SHORT, GLU_SHORT,
50 GLU_UNSIGNED_INT, GLU_INT, GLU_FLOAT, GLU_UNSIGNED_BYTE_3_3_2,
51 GLU_UNSIGNED_BYTE_2_3_3_REV, GLU_UNSIGNED_SHORT_5_6_5,
52 GLU_UNSIGNED_SHORT_5_6_5_REV, GLU_UNSIGNED_SHORT_4_4_4_4,
53 GLU_UNSIGNED_SHORT_4_4_4_4_REV, GLU_UNSIGNED_SHORT_5_5_5_1,
54 GLU_UNSIGNED_SHORT_1_5_5_5_REV, GLU_UNSIGNED_INT_8_8_8_8,
55 GLU_UNSIGNED_INT_8_8_8_8_REV, GLU_UNSIGNED_INT_10_10_10_2, or
56 GLU_UNSIGNED_INT_2_10_10_10_REV.
57
58 data
59 Specifies a pointer to the image data in memory.
60
62 gluBuild1DMipmaps builds a series of prefiltered one-dimensional
63 texture maps of decreasing resolutions called a mipmap. This is used
64 for the antialiasing of texture mapped primitives.
65
66 A return value of zero indicates success, otherwise a GLU error code is
67 returned (see gluErrorString()).
68
69 Initially, the width of data is checked to see if it is a power of 2.
70 If not, a copy of data is scaled up or down to the nearest power of 2.
71 (If width is exactly between powers of 2, then the copy of data will
72 scale upwards.) This copy will be used for subsequent mipmapping
73 operations described below. For example, if width is 57, then a copy of
74 data will scale up to 64 before mipmapping takes place.
75
76 Then, proxy textures (see glTexImage1D()) are used to determine if the
77 implementation can fit the requested texture. If not, width is
78 continually halved until it fits.
79
80 Next, a series of mipmap levels is built by decimating a copy of data
81 in half until size 1 × 1 is reached. At each level, each texel in the
82 halved mipmap level is an average of the corresponding two texels in
83 the larger mipmap level.
84
85 glTexImage1D() is called to load each of these mipmap levels. Level 0
86 is a copy of data. The highest level is log 2 width. For example, if
87 width is 64 and the implementation can store a texture of this size,
88 the following mipmap levels are built: 64 × 1, 32 × 1, 16 × 1, 8 × 1, 4
89 × 1, 2 × 1, and 1 × 1. These correspond to levels 0 through 6,
90 respectively.
91
92 See the glTexImage1D() reference page for a description of the
93 acceptable values for the type parameter. See the glDrawPixels()
94 reference page for a description of the acceptable values for the data
95 parameter.
96
98 Note that there is no direct way of querying the maximum level. This
99 can be derived indirectly via glGetTexLevelParameter(). First, query
100 for the width actually used at level 0. (The width may not be equal to
101 width since proxy textures might have scaled it to fit the
102 implementation.) Then the maximum level can be derived from the formula
103 log 2 width.
104
105 Formats GLU_BGR, and GLU_BGRA, and types GLU_UNSIGNED_BYTE_3_3_2,
106 GLU_UNSIGNED_BYTE_2_3_3_REV, GLU_UNSIGNED_SHORT_5_6_5,
107 GLU_UNSIGNED_SHORT_5_6_5_REV, GLU_UNSIGNED_SHORT_4_4_4_4,
108 GLU_UNSIGNED_SHORT_4_4_4_4_REV, GLU_UNSIGNED_SHORT_5_5_5_1,
109 GLU_UNSIGNED_SHORT_1_5_5_5_REV, GLU_UNSIGNED_INT_8_8_8_8,
110 GLU_UNSIGNED_INT_8_8_8_8_REV, GLU_UNSIGNED_INT_10_10_10_2, and
111 GLU_UNSIGNED_INT_2_10_10_10_REV are only available if the GL version is
112 1.2 or greater, and if the GLU version is 1.3 or greater.
113
115 GLU_INVALID_VALUE is returned if width is < 1.
116
117 GLU_INVALID_ENUM is returned if format or type are not legal.
118
119 GLU_INVALID_OPERATION is returned if type is GLU_UNSIGNED_BYTE_3_3_2 or
120 GLU_UNSIGNED_BYTE_2_3_3_REV and format is not GLU_RGB.
121
122 GLU_INVALID_OPERATION is returned if type is GLU_UNSIGNED_SHORT_5_6_5
123 or GLU_UNSIGNED_SHORT_5_6_5_REV and format is not GLU_RGB.
124
125 GLU_INVALID_OPERATION is returned if type is GLU_UNSIGNED_SHORT_4_4_4_4
126 or GLU_UNSIGNED_SHORT_4_4_4_4_REV and format is neither GLU_RGBA nor
127 GLU_BGRA.
128
129 GLU_INVALID_OPERATION is returned if type is GLU_UNSIGNED_SHORT_5_5_5_1
130 or GLU_UNSIGNED_SHORT_1_5_5_5_REV and format is neither GLU_RGBA nor
131 GLU_BGRA.
132
133 GLU_INVALID_OPERATION is returned if type is GLU_UNSIGNED_INT_8_8_8_8
134 or GLU_UNSIGNED_INT_8_8_8_8_REV and format is neither GLU_RGBA nor
135 GLU_BGRA.
136
137 GLU_INVALID_OPERATION is returned if type is
138 GLU_UNSIGNED_INT_10_10_10_2 or GLU_UNSIGNED_INT_2_10_10_10_REV and
139 format is neither GLU_RGBA nor GLU_BGRA.
140
142 gluBuild1DMipmapLevels(), gluBuild2DMipmapLevels(),
143 gluBuild2DMipmaps(), gluBuild3DMipmapLevels(), gluBuild3DMipmaps(),
144 gluErrorString(), glDrawPixels(), glGetTexImage(),
145 glGetTexLevelParameter(), glTexImage1D(), glTexImage2D(),
146 glTexImage3D()
147
149 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
150 under the SGI Free Software B License. For details, see
151 http://oss.sgi.com/projects/FreeB/.
152
154 opengl.org
155
156
157
158opengl.org 07/13/2018 GLUBUILD1DMIPMAPS(3G)