logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

glGenerateMipmap, glGenerateTextureMipmap - generate mipmaps for a specified texture object

C Specification

voidglGenerateMipmap(GLenumtarget);voidglGenerateTextureMipmap(GLuinttexture);

Description

glGenerateMipmap and glGenerateTextureMipmap generates mipmaps for the specified texture object. For
       glGenerateMipmap, the texture object is that bound to to target. For glGenerateTextureMipmap, texture is
       the name of the texture object.

       For cube map and cube map array textures, the texture object must be cube complete or cube array complete
       respectively.

       Mipmap generation replaces texel image levels $level_{base} + 1$ through $q$ with images derived from the
       $level_{base}$ image, regardless of their previous contents. All other mimap images, including the
       $level_{base}+1$ image, are left unchanged by this computation.

       The internal formats of the derived mipmap images all match those of the $level_{base}$ image. The
       contents of the derived images are computed by repeated, filtered reduction of the $level_{base} + 1$
       image. For one- and two-dimensional array and cube map array textures, each layer is filtered
       independently.

Errors

GL_INVALID_ENUM is generated by glGenerateMipmap if target is not one of the accepted texture targets.

       GL_INVALID_OPERATION is generated by glGenerateTextureMipmap if texture is not the name of an existing
       texture object.

       GL_INVALID_OPERATION is generated if target is GL_TEXTURE_CUBE_MAP or GL_TEXTURE_CUBE_MAP_ARRAY, and the
       specified texture object is not cube complete or cube array complete, respectively.

Name

       glGenerateMipmap, glGenerateTextureMipmap - generate mipmaps for a specified texture object

Notes

       Cube map array textures are accepted only if the GL version is 4.0 or higher.

Parameters

target
           Specifies the target to which the texture object is bound for glGenerateMipmap. Must be one of
           GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D_ARRAY,
           GL_TEXTURE_CUBE_MAP, or GL_TEXTURE_CUBE_MAP_ARRAY.

       texture
           Specifies the texture object name for glGenerateTextureMipmap.

See Also

glTexImage2D(), glBindTexture(), glGenTextures()

Version Support

       ┌─────────────────────────┬───────────────────────────────────────────────────────────────────────┐
       │                         │                OpenGLVersion                                         │
       ├─────────────────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
       │ Function2.02.13.03.13.23.34.04.14.24.34.44.5 │
       │ /                       │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Feature                 │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Name                    │     │     │     │     │     │     │     │     │     │     │     │     │
       ├─────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glGenerateMipmap        │  -  │  -  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │
       ├─────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glGenerateTextureMipmap │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  ✔  │
       └─────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

See Also