GLAPI/glGenerateMipmap: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
m Renaming category: 'GL 4 API Texturing' to 'Core API Ref Texturing'.
m Bot: Adding better formatting.
Line 8: Line 8:
== Function Definition ==
== Function Definition ==


   void '''glGenerateMipmap'''(GLenum ''target'');
   void '''glGenerateMipmap'''(GLenum {{param|target}});


; target
; target
: Specifies the target to which the texture whose mimaps to generate is bound. ''target'' must be {{code|GL_TEXTURE_1D}}, {{code|GL_TEXTURE_2D}}, {{code|GL_TEXTURE_3D}}, {{code|GL_TEXTURE_1D_ARRAY}}, {{code|GL_TEXTURE_2D_ARRAY}}, {{code|GL_TEXTURE_CUBE_MAP}}, or {{code|GL_TEXTURE_CUBE_MAP_ARRAY}}.
: Specifies the target to which the texture whose mimaps to generate is bound. {{param|target}} must be {{code|GL_TEXTURE_1D}}, {{code|GL_TEXTURE_2D}}, {{code|GL_TEXTURE_3D}}, {{code|GL_TEXTURE_1D_ARRAY}}, {{code|GL_TEXTURE_2D_ARRAY}}, {{code|GL_TEXTURE_CUBE_MAP}}, or {{code|GL_TEXTURE_CUBE_MAP_ARRAY}}.


== Description ==
== Description ==


'''glGenerateMipmap''' generates mipmaps for the texture attached to ''target'' of the active texture unit. For cube map textures, a {{code|GL_INVALID_OPERATION}} error is generated if the texture attached to ''target'' is not cube complete.
'''glGenerateMipmap''' generates mipmaps for the texture attached to {{param|target}} of the active texture unit. For cube map textures, a {{code|GL_INVALID_OPERATION}} error is generated if the texture attached to {{param|target}} is not cube complete.


Mipmap generation replaces texel array levels ''level<sub>base</sub>'' + 1 through ''q'' with arrays derived from the ''level<sub>base</sub>'' array, regardless of their previous contents. All other mimap arrays, including the ''level<sub>base</sub>'' array, are left unchanged by this computation.
Mipmap generation replaces texel array levels ''level<sub>base</sub>'' + 1 through ''q'' with arrays derived from the ''level<sub>base</sub>'' array, regardless of their previous contents. All other mimap arrays, including the ''level<sub>base</sub>'' array, are left unchanged by this computation.
Line 23: Line 23:
== Errors ==
== Errors ==


{{code|GL_INVALID_ENUM}} is generated if ''target'' is not one of the accepted texture targets.
{{code|GL_INVALID_ENUM}} is generated if {{param|target}} is not one of the accepted texture targets.


{{code|GL_INVALID_OPERATION}} is generated if ''target'' is {{code|GL_TEXTURE_CUBE_MAP}} and the texture bound to the {{code|GL_TEXTURE_CUBE_MAP}} target of the active texture unit is not cube complete.
{{code|GL_INVALID_OPERATION}} is generated if {{param|target}} is {{code|GL_TEXTURE_CUBE_MAP}} and the texture bound to the {{code|GL_TEXTURE_CUBE_MAP}} target of the active texture unit is not cube complete.


== See Also ==
== See Also ==


[[GLAPI/glTexImage2D|glTexImage2D]], [[GLAPI/glBindTexture|glBindTexture]], [[GLAPI/glGenTextures|glGenTextures]]
{{apifunc|glTexImage2D}}, {{apifunc|glBindTexture}}, {{apifunc|glGenTextures}}


== Copyright ==
== Copyright ==

Revision as of 01:18, 29 April 2012

glGenerateMipmap
Core in version 4.6
Core since version 3.0

glGenerateMipmap: generate mipmaps for a specified texture target

Function Definition

 void glGenerateMipmap(GLenum target​);
target
Specifies the target to which the texture whose mimaps to generate is bound. target​ must be 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.

Description

glGenerateMipmap generates mipmaps for the texture attached to target​ of the active texture unit. For cube map textures, a GL_INVALID_OPERATION error is generated if the texture attached to target​ is not cube complete.

Mipmap generation replaces texel array levels levelbase + 1 through q with arrays derived from the levelbase array, regardless of their previous contents. All other mimap arrays, including the levelbase array, are left unchanged by this computation.

The internal formats of the derived mipmap arrays all match those of the levelbase array. The contents of the derived arrays are computed by repeated, filtered reduction of the levelbase array. For one- and two-dimensional texture arrays, each layer is filtered independently.

Errors

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

GL_INVALID_OPERATION is generated if target​ is GL_TEXTURE_CUBE_MAP and the texture bound to the GL_TEXTURE_CUBE_MAP target of the active texture unit is not cube complete.

See Also

glTexImage2D, glBindTexture, glGenTextures

Copyright

Copyright © 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.