The WebGLRenderingContext.generateMipmap() method of the WebGL API generates a set of mipmaps for a WebGLTexture object.

Mipmaps are used to create distance with objects. A higher-resolution mipmap is used for objects that are closer, and a lower-resolution mipmap is used for objects that are farther away. It starts with the resolution of the texture image and halves the resolution until a 1x1 dimension texture image is created.


void gl.generateMipmap(target);


A GLenum specifying the binding point (target) of the active texture whose mipmaps will be generated. Possible values:
  • gl.TEXTURE_2D: A two-dimensional texture.
  • gl.TEXTURE_CUBE_MAP: A cube-mapped texture.
  • When using a WebGL 2 context, the following values are available additionally:
    • gl.TEXTURE_3D: A three-dimensional texture.
    • gl.TEXTURE_2D_ARRAY: A two-dimensional array texture.

Return value





Specification Status Comment
WebGL 1.0
The definition of 'generateMipmap' in that specification.
Recommendation Initial definition for WebGL.
OpenGL ES 2.0
The definition of 'glGenerateMipmap' in that specification.
Standard Man page of the (similar) OpenGL ES 2.0 API.
OpenGL ES 3.0
The definition of 'glGenerateMipmap' in that specification.
Standard Man page of the (similar) OpenGL ES 3.0 API.

Browser compatibility

ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
generateMipmapChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Firefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8Samsung Internet Android Full support 1.5
WebGL2Chrome Full support 56Edge Full support 79Firefox Full support 51IE No support NoOpera Full support 43Safari No support NoWebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 51Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0


Full support
Full support
No support
No support

See also