Mipmapping

Mipmapping is a technique in image processing that takes an original, high-resolution texture image and scales it into multiple smaller-resolution textures.

MIP level is each scaled down texture. For example, let original texture has size 128x128. Then original size is level 0, 64x64 is level 1, 32x32 is level 2 and so on.

These scaled textures are used to represent colors and textures more naturally when being viewed from a distance. It also reduces the load on the processor.

function description
glGenerateMipmap(target) Generates mipmaps for the specified target. Possible values of target are:
  • GL_TEXTURE_1D
  • GL_TEXTURE_2D
  • GL_TEXTURE_3D
  • GL_TEXTURE_1D_ARRAY
  • GL_TEXTURE_2D_ARRAY
  • GL_TEXTURE_CUBE_MAP
  • GL_TEXTURE_CUBE_MAP_ARRAY
glGenerateTextureMipmap(idTexture) Generates mipmaps for the specified texture object.
glTexParameter(target, pName, pValue) Regard to mipmapping you can set GL_TEXTURE_MIN_FILTER parameter with one of the following values:
  • GL_NEAREST_MIPMAP_NEAREST - chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_NEAREST criterion to produce a texture value.
  • GL_LINEAR_MIPMAP_NEAREST - chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_LINEAR criterion to produce a texture value.
  • GL_NEAREST_MIPMAP_LINEAR - chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_NEAREST criterion to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
  • GL_LINEAR_MIPMAP_LINEAR - chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_LINEAR criterion to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.