Texture Data

Texture data, like a normal digital image, is a 2 dimensional array of colors.

void glTexImage2D( GLenum target, GLint level, GLint internalFormat,
                   GLsizei width, GLsizei height, GLint border,
                   GLenum format, GLenum type, const GLvoid *pixels )
height
width

target should be GL_TEXTURE_2D. level should be 0 (gluBuild2DMipmaps is used to automatically generate other levels).

Typical values for internalFormat and format are:

border is normally 0.

type is normally GL_UNSIGNED_BYTE, indicating that each individual red, green, or blue (or other) value is a single byte.

Other internal formats and data types are available for higher quality data, or for special optimizations.


Important: The width & height of a texture image must be powers of 2 - i.e., 2, 4, 8, 16, 32, 64, 128, 256, 512, etc.




next