Share via


gluBuild2DMipmaps

The gluBuild2DMipmaps function creates 2-D mipmaps.

int gluBuild2DMipmaps(
  GLenum target,  GLint components,  GLint width,  GLint height,  GLenum format,  GLenum type,  const void *data);

Parameters

  • target
    The target texture. Must be GL_TEXTURE_2D.
  • components
    The number of color components in the texture. Must be 1, 2, 3, or 4.
  • width, height
    The width and height, respectively, of the texture image.
  • format
    The format of the pixel data. Must be one of the following: GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA, GL_BGR_EXT, GL_BGRA_EXT, GL_LUMINANCE, or GL_LUMINANCE_ALPHA.
  • type
    The data type for data. Must be one of the following: GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, or GL_FLOAT.
  • data
    A pointer to the image data in memory.

Remarks

The gluBuild2DMipmaps function obtains the input image and generates all mipmap images (using gluScaleImage) so the input image can be used as a mipmapped texture image. To load each of the images, call glTexImage2D. If the dimensions of the input image are not powers of two, then the image is scaled so that both the width and height are powers of two before the mipmaps are generated.

A return value of zero indicates success. Otherwise, a GLU error code is returned.

For a description of the acceptable values for the format parameter, see glTexImage2D. For a description of the acceptable values for type, ** see glDrawPixels.

Requirements

**  Windows NT/2000:** Requires Windows NT 3.5 or later.
**  Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
**  Header:** Declared in Glu.h.
**  Library:** Use Glu32.lib.

See Also

glDrawPixels, glTexImage2D, gluBuild1DMipmaps, gluScaleImage