[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

gluBuild2DMipmaps Subroutine

Purpose

Creates 2-dimensional (2D) mipmaps.

Library

OpenGL C bindings library: libGL.a

C Syntax

int gluBuild2DMipmaps(GLenum Target, 
   GLint Components, 
   GLintWidth, 
   GLint Height, 
   GLenum Format, 
   GLenum Type, 
   const void *Data)

Description

The gluBuild2DMipmaps subroutine obtains the input image and uses the gluScaleImage subroutine to generate all mipmap images necessary so that the input image can be used as a mipmapped texture image. The glTexImage2D subroutine is then called to load each of the images. If the dimensions of the input image are not powers of two, 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. (See the gluErrorString subroutine.)

See the glTexImage1D subroutine for a description of the acceptable values for the Format parameter. See the glDrawPixels subroutine for acceptable values for the Type parameter.

Parameters

Target Specifies the target texture. This value must be GL_TEXTURE_2D.
Components Specifies the number of color components in the texture. Values must be 1, 2, 3, or 4 only.
Width Specifies the width of the texture image.
Height Specifies the height of the texture image.
Format Specifies the format of the pixel data. The following symbolic values are valid:
  • GL_COLOR_INDEX
  • GL_RED
  • GL_GREEN
  • GL_BLUE
  • GL_ALPHA
  • GL_RGB
  • GL_RGBA
  • GL_LUMINANCE
  • GL_LUMINANCE_ALPHA
(See the glTexImage1D subroutine for acceptable values for the Format parameter.)
Type Specifies the data type. The following data types are valid:
  • GL_UNSIGNED_BYTE
  • GL_BYTE
  • GL_BITMAP
  • GL_UNSIGNED_SHORT
  • GL_SHORT
  • GL_UNSIGNED_INT
  • GL_INT
  • GL_FLOAT
(See the glDrawPixels subroutine for acceptable values for the Type parameter.)
Data Specifies a pointer to the image data in memory.

Return Values

0 Indicates the mipmap images were successfully built. Otherwise, a GLU error code is returned. (See the gluErrorString subroutine for standard GLU error codes.)

Files

/usr/include/GL/gl.h Contains C language constraints, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The glDrawPixels subroutine, glTexImage1D subroutine, glTexImage2D subroutine, gluBuild1DMipmaps subroutine, gluErrorString subroutine, gluScaleImage subroutine.

OpenGL Overview.


[ Previous | Next | Contents | Glossary | Home | Search ]