GLint gluBuild1DMipmaps( GLenum target, GLint component, GLsizei width, GLenum format, GLenum type, const void *data)
A return value of 0 indicates success. Otherwise a GLU error code is returned (see gluErrorString).
gluBuild1DMipmaps first checks whether the width of data is a power of 2. If not, it scales a copy of data (up or down) to the nearest power of two. This copy is used as the base for subsequent mipmapping operations. For example, if width is 57, a copy of data scales up to 64 before mipmapping takes place. (If width is exactly between powers of 2, the copy of data is scaled upward.)
If the GL version is 1.1 or greater, gluBuild1DMipmaps uses proxy textures (see glTexImage1D) to determine if the implementation can store the requested texture in texture memory. If there isn't enough room, width is halved (and halved again) until it fits.
Next, gluBuild1DMipmaps builds a series of mipmap levels; it halves a copy of data (or a scaled version of data, if necessary) until size 1 is reached. At each level, each texel in the halved image is an average of the corresponding two texels in the larger image.
glTexImage1D is called to load each
of these images by level. If width is a power of 2 which fits
in the implementation, level 0 is a copy of data, and the
highest level is log2 width. For example, if
width is 64 the following images are built: 641, 32
1, 16
1, 8
1, 4
1, 2
1 and 1
1. These correspond to levels 0 through 6,
respectively.
See the glTexImage1D reference page for a description of the acceptable values for format. See the glDrawPixels reference page for a description of the acceptable values for type.