The WebGLRenderingContext.getExtension() method enables a WebGL extension.
Syntax
gl.getExtension(name);
Parameters
- name
- A
Stringfor the name of the WebGL extension to enable.
Return value
A WebGL extension object, or null if name does not match (case-insensitive) to one of the strings in WebGLRenderingContext.getSupportedExtensions.
Examples
Once a WebGL extension is enabled, you are able to use the methods, properties or constants that this extension object provides.
var canvas = document.getElementById('canvas');
gl = canvas.getContext('webgl');
gl.getExtension('WEBGL_lose_context').loseContext();
WebGL extensions
Extensions for the WebGL API are registered in the WebGL Extension Registry. The current extensions are:
ANGLE_instanced_arraysEXT_blend_minmaxEXT_color_buffer_floatEXT_color_buffer_half_floatEXT_disjoint_timer_queryEXT_float_blend'EXT_frag_depthEXT_sRGBEXT_shader_texture_lodEXT_texture_compression_bptcEXT_texture_compression_rgtcEXT_texture_filter_anisotropicKHR_parallel_shader_compileOES_element_index_uintOES_fbo_render_mipmapOES_standard_derivativesOES_texture_floatOES_texture_float_linearOES_texture_half_floatOES_texture_half_float_linearOES_vertex_array_objectOVR_multiview2WEBGL_color_buffer_floatWEBGL_compressed_texture_astcWEBGL_compressed_texture_atcWEBGL_compressed_texture_etcWEBGL_compressed_texture_etc1WEBGL_compressed_texture_pvrtcWEBGL_compressed_texture_s3tcWEBGL_compressed_texture_s3tc_srgbWEBGL_debug_renderer_infoWEBGL_debug_shadersWEBGL_depth_textureWEBGL_draw_buffersWEBGL_lose_context
Specifications
| Specification | Status | Comment |
| WebGL 1.0The definition of 'WebGLRenderingContext.getExtension' in that specification. | Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getExtension
|
Chrome
Full support 9 |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support 11 |
Opera
Full support 12 |
Safari
Full support 5.1 |
WebView Android
Full support Yes |
Chrome Android
Full support 25 |
Firefox Android
Full support Yes |
Opera Android
Full support 12 |
Safari iOS
Full support 8 |
Samsung Internet Android
Full support 1.5 |
Legend
- Full support
- Full support
See also
WebGLRenderingContext.getExtension() by Mozilla Contributors is licensed under CC-BY-SA 2.5.