--- title: 'WebGL_API: Web için 2D ve 3D grafikler' slug: Web/API/WebGL_API translation_of: Web/API/WebGL_API ---
{{WebGLSidebar}}

WebGL (Web Grafik Kütüphanesi) herhangi bir plug-in kullanmadan, uyumlu bütün tarayıcılarda 3D ve 2D grafikler oluşturabilen bir JavaScript API'sidir. WebGL bunu, HTML5 {{HTMLElement ("canvas")}} öğelerinde kullanılabilen OpenGL ES 2.0'a yakın bir API'yi sunarak yapar.

WebGL desteği şuan için şu tarayıcılarda mevcuttur: Firefox 4+, Google Chrome 9+, Opera 12+, Safari 5.1+, Internet Explorer 11+, and Microsoft Edge build 10240+; ancak, kullanıcının kullandığı cihazın donanımı da bu özellikleri desteklemesi gerekmektedir.

{{HTMLElement("canvas")}} öğesi ayrıca Canvas 2D tarafından web sayfalarında 2D grafikler oluşturmak için de kullanılır.

Referans

Standart arayüzler

Uzantılar

Events

Sabitler ve tipleri

WebGL 2

WebGL 2 is a major update to WebGL which is provided through the {{domxref("WebGL2RenderingContext")}} interface. It is based on OpenGL ES 3.0 and new features include:

See also the blog post "WebGL 2 lands in Firefox" and webglsamples.org/WebGL2Samples for a few demos.

Guides and tutorials

Below, you'll find an assortment of guides to help you learn WebGL concepts and tutorials that offer step-by-step lessons and examples.

Guides

Data in WebGL
A guide to variables, buffers, and other types of data used when writing WebGL code.
WebGL best practices
Tips and suggestions to help you improve the quality, performance, and reliability of your WebGL content.
Using extensions
A guide to using WebGL extensions.

Tutorials

WebGL tutorial
A beginner's guide to WebGL core concepts. A good place to start if you don't have previous WebGL experience.

Examples

A basic 2D WebGL animation example
This example demonstrates the simple animation of a one-color shape. Topics examined are adapting to aspect ratio differences, a function to build shader programs from sets of multiple shaders, and the basics of drawing in WebGL.

Advanced tutorials

WebGL model view projection
A detailed explanation of the three core matrices that are typically used to represent a 3D object view: the model, view and projection matrices.
Matrix math for the web
A useful guide to how 3D transform matrices work, and can be used on the web — both for WebGL calculations and in CSS3 transforms.

Resources

Libraries

Specifications

Specification Status Comment
{{SpecName('WebGL')}} {{Spec2('WebGL')}} Initial definition. Based on OpenGL ES 2.0
{{SpecName('WebGL2')}} {{Spec2('WebGL2')}} Builds on top of WebGL 1. Based on OpenGL ES 3.0.
{{SpecName('OpenGL ES 2.0')}} {{Spec2('OpenGL ES 2.0')}}  
{{SpecName('OpenGL ES 3.0')}} {{Spec2('OpenGL ES 3.0')}}  

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 9 {{CompatVersionUnknown}} {{CompatGeckoDesktop("2.0")}} 11 12 5.1
WebGL 2 56 {{CompatNo}} {{CompatGeckoDesktop("51")}} {{CompatNo}} 43 {{CompatNo}}
Feature Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 25 {{CompatVersionUnknown}} 4 {{CompatNo}} 12 8.1
WebGL 2 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

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 webgl2.

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