MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

Deze vertaling is niet volledig. Help dit artikel te vertalen vanuit het Engels.

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 <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 <canvas> element wordt ook gebruikt door Canvas 2D om 2D graphics te tonen op webpagina's.

Referenties

Handleidingen en Tutorials

  • WebGL tutorial: Een beginners gids naar WebGL kern concepten. Een goede plek om te beginnen wanneer je nog geen WebGL ervaring hebt.
  • WebGL best practices: Tips and suggestions to improve your WebGL content.
  • Using extensions: How to use extensions that are available 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

  • Raw WebGL: An introduction to WebGL A talk by Nick Desaulniers that introduces the basics of WebGL. This is a great place to start if you've never done low-level graphics programming.
  • Khronos WebGL site The main web site for WebGL at the Khronos Group.
  • Learning WebGL A site with tutorials on how to use WebGL.
  • WebGL Fundamentals A basic tutorial with fundamentals of WebGL.
  • WebGL playground An online tool for creating and sharing WebGL projects. Good for quick prototyping and experimenting.
  • WebGL Academy An HTML/JavaScript editor with tutorials to learn basics of webgl programming.

Libraries

  • glMatrix JavaScript Matrix and Vector library for High Performance WebGL apps
  • Sylvester An open source library for manipulating vectors and matrices. Not optimized for WebGL but extremely robust.

Specifications

Specification Status Comment
WebGL 1.0 Recommendation Initial definition.
WebGL 2.0 Editor's Draft  

Browser compatibility

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support 4.0 (2.0) 9 11 12[1] 5.1[1]
OES_texture_float 6.0 (6.0) ? ? ? ?
OES_standard_derivatives 10.0 (10.0) ? ? ? ?
EXT_texture_filter_anisotropic 13.0 (13.0) ? ? ? ?
WEBGL_compressed_texture_s3tc 15.0 (15.0) ? ? ? ?
drawingBufferWidth and drawingBufferHeight attributes 9.0 (9.0) ? ? ? ?
Feature Firefox Mobile (Gecko) Chrome for Android IE Mobile Opera Mobile Safari Mobile
Basic support 4 25[1] Not supported 12[1] 8.1
drawingBufferWidth and drawingBufferHeight attributes 9.0 (9.0) 25 ? ? ?
OES_texture_float 6.0 (6.0) 25 ? ? ?
OES_standard_derivatives 10.0 (10.0) 25 ? ? ?
EXT_texture_filter_anisotropic 13.0 (13.0) 25 ? ? ?
OES_element_index_uint ? 25 ? ? ?
OES_vertex_array_object ? 25 ? ? ?
WEBGL_compressed_texture_s3tc 15.0 (15.0) 25WEBKIT_ ? ? ?
WEBKIT_EXT_texture_filter_nisotropic Not supported 25 Not supported Not supported ?

[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 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), 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

Documentlabels en -medewerkers

Labels: 
 Aan deze pagina hebben bijgedragen: Volluta, fscholz, JonasLesage
 Laatst bijgewerkt door: Volluta,