--- title: WebGL slug: Web/API/WebGL_API tags: - WebGL translation_of: Web/API/WebGL_API ---

{{WebGLSidebar}}

WebGL (Web Graphics Library) is een JavaScript API voor het renderen van interactieve 3D en 2D graphics binnen elke compatibele webbrowser zonder het gebruik van plug-ins. WebGL daartoe worden een API die nauw overeenkomt met OpenGL ES 2.0 die kunnen worden gebruikt in HTML5 {{HTMLElement ("canvas")}} elementen.

Ondersteuning voor WebGL is aanwezig in Firefox 4+, Google Chrome 9+, Opera 12+, Safari 5.1+ en Internet Explorer 11+; echter, moet het apparaat van de gebruiker ook hardware hebben die deze functies ondersteunt.

Het {{HTMLElement("canvas")}} element wordt ook gebruikt door Canvas 2D om 2D graphics te tonen op webpagina's.

Referenties

Handleidingen en Tutorials

Advanced tutorials

Resources

Libraries

Specifications

Specification Status Comment
{{SpecName('WebGL')}} {{Spec2('WebGL')}} Initial definition.
{{SpecName('WebGL2')}} {{Spec2('WebGL2')}}  

Browser compatibility

{{CompatibilityTable}}
Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support {{CompatGeckoDesktop("2.0")}} 9 11 12[1] 5.1[1]
OES_texture_float {{CompatGeckoDesktop("6.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
OES_standard_derivatives {{CompatGeckoDesktop("10.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
EXT_texture_filter_anisotropic {{CompatGeckoDesktop("13.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
WEBGL_compressed_texture_s3tc {{CompatGeckoDesktop("15.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
drawingBufferWidth and drawingBufferHeight attributes {{CompatGeckoDesktop("9.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Firefox Mobile (Gecko) Chrome for Android IE Mobile Opera Mobile Safari Mobile
Basic support 4 25[1] {{CompatNo}} 12[1] 8.1
drawingBufferWidth and drawingBufferHeight attributes {{CompatGeckoMobile("9.0")}} 25 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
OES_texture_float {{CompatGeckoMobile("6.0")}} 25 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
OES_standard_derivatives {{CompatGeckoMobile("10.0")}} 25 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
EXT_texture_filter_anisotropic {{CompatGeckoMobile("13.0")}} 25 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
OES_element_index_uint {{CompatUnknown}} 25 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
OES_vertex_array_object {{CompatUnknown}} 25 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
WEBGL_compressed_texture_s3tc {{CompatGeckoMobile("15.0")}} 25{{property_prefix("WEBKIT_")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
WEBKIT_EXT_texture_filter_nisotropic {{CompatNo}} 25 {{CompatNo}} {{CompatNo}} {{CompatUnknown}}

[1] The implementation of this feature is experimental.

Compatibility notes

In addition to the browser, the GPU itself also needs to support the feature. So, for example, S3 Texture Compression (S3TC) is only available on Tegra-based tablets. Most browsers make the WebGL context available through the webgl context name, but older ones need experimental-webgl as well. In addition, the upcoming WebGL 2 is fully backwards-compatible and will have the context name experimental-webgl2 in the future for testing.

Gecko notes

WebGL debugging and testing

Starting with Gecko 10.0 {{geckoRelease("10.0")}}, there are two preferences available which let you control the capabilities of WebGL for testing purposes:

webgl.min_capability_mode
A Boolean property that, when true, enables a minimum capability mode. When in this mode, WebGL is configured to only support the bare minimum feature set and capabilities required by the WebGL specification. This lets you ensure that your WebGL code will work on any device or browser, regardless of their capabilities. This is false by default.
webgl.disable_extensions
A Boolean property that, when true, disables all WebGL extensions. This is false by default.

See also