--- title: WebGL slug: Web/API/WebGL_API tags: - WebGL translation_of: Web/API/WebGL_API ---
WebGL (Web Graphics Library) to API języka JavaScript służące do renderowania (rysowania) interaktywnej grafiki 3D i 2D poprzez kompatybilną przeglądarkę bez używania pluginów. WebGL został oparty na API OpenGL ES 2.0 i może zostać wykorzystany do pracy z elementem {{HTMLElement("canvas")}}.
Aktualnie Jest wspierany przez Firefox 4+, Google Chrome 9+, Opera 12+, Safari 5.1+ i Internet Explorer 11+; ponad to urządzenie użytkownika musi także spełniać odpowiednie warunki sprzętowe, aby móc obsłużyć WebGL (przede wszystkim obsługiwać OpenGL co najmniej w wersji 2.0).
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatGeckoDesktop("2.0")}} | 9 | 11 | 12 (experiment) | 5.1 (experiment) |
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 (experiment) | {{CompatNo}} | 12 (experiment) | 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 prefixed with WEBKIT_ |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
WEBKIT_EXT_texture_filter_nisotropic |
{{CompatNo}} | 25 | {{CompatNo}} | {{CompatNo}} | {{CompatUnknown}} |
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.
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
false
jest ustawiona domyślnie.webgl.disable_extensions
false
jest ustawiona domyślnie.