WebGL - Web APIs | MDN (2024)

WebGL (Web Graphics Library) is a JavaScript API for rendering interactive 3D and 2D graphics within any compatible web browser without the use of plug-ins. WebGL does so by introducing an API that closely conforms to OpenGL ES 2.0 that can be used in HTML5 <canvas> elements.

Support for WebGL is present in Firefox4+, Google Chrome 9+, Opera12+, Safari 5.1+ and Internet Explorer 11+; however, the user's device must also have hardware that supports these features.

The <canvas> element is also used by Canvas 2D to do 2D graphics on web pages.

Reference

Standard interfaces

  • WebGLRenderingContext
  • WebGL2RenderingContext
  • WebGLActiveInfo
  • WebGLBuffer
  • WebGLContextEvent
  • WebGLFramebuffer
  • WebGLProgram
  • WebGLQuery
  • WebGLRenderbuffer
  • WebGLSampler
  • WebGLShader
  • WebGLShaderPrecisionFormat
  • WebGLSync
  • WebGLTexture
  • WebGLTransformFeedback
  • WebGLUniformLocation
  • WebGLVertexArrayObject

Extensions

  • ANGLE_instanced_arrays
  • EXT_blend_minmax
  • EXT_color_buffer_float
  • EXT_color_buffer_half_float
  • EXT_disjoint_timer_query
  • EXT_frag_depth
  • EXT_sRGB
  • EXT_shader_texture_lod
  • EXT_texture_filter_anisotropic
  • OES_element_index_uint
  • OES_standard_derivatives
  • OES_texture_float
  • OES_texture_float_linear
  • OES_texture_half_float
  • OES_texture_half_float_linear
  • OES_vertex_array_object
  • WEBGL_color_buffer_float
  • WEBGL_compressed_texture_astc
  • WEBGL_compressed_texture_atc
  • WEBGL_compressed_texture_etc
  • WEBGL_compressed_texture_etc1
  • WEBGL_compressed_texture_pvrtc
  • WEBGL_compressed_texture_s3tc
  • WEBGL_compressed_texture_s3tc_srgb
  • WEBGL_debug_renderer_info
  • WEBGL_debug_shaders
  • WEBGL_depth_texture
  • WEBGL_draw_buffers
  • WEBGL_lose_context

Events

  • webglcontextlost
  • webglcontextrestored
  • webglcontextcreationerror

Constants and types

  • WebGL constants
  • WebGL types

WebGL 2

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

  • 3D textures,
  • Sampler objects,
  • Uniform Buffer objects,
  • Sync objects,
  • Query objects,
  • Tranform Feedback objects,
  • Promoted extensions that are now core to WebGL 2: Vertex Array objects, instancing, multiple render targets, fragment depth.

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

Guides and tutorials

  • WebGL tutorial: A beginner's guide to WebGL core concepts. A good place to start if you don't have previous WebGL experience.
  • 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.
  • WebGL Stats A site with statistics about WebGL capabilities in browsers on different platforms.

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. Based on OpenGL ES 2.0
WebGL 2.0 Editor's Draft Builds on top of WebGL 1. Based on OpenGL ES 3.0.
OpenGL ES 2.0 Standard
OpenGL ES 3.0 Standard

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 9 (Yes) 4.0 (2.0) 11 12 5.1
WebGL 2 56 Nosupport 51 (51) Nosupport 43 Nosupport
Feature Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 25 (Yes) 4 Nosupport 12 8.1
WebGL 2 ? ? ? ? ? ?

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 (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

  • Canvas
  • Compatibility info about WebGL extensions
WebGL - Web APIs | MDN (2024)
Top Articles
Nms Rusted Metal
Ktbs Payroll Login
159R Bus Schedule Pdf
Butte Jail Roster Butte Mt
Champion Our Cause Wow
Jikatabi Thothub
One Hour Rosemary Focaccia Bread
Saxies Lake Worth
Champion Enchant Skyblock
Craigslist Free Stuff Columbus Ga
Getwush Com
Timeless - Complete Series Rewatch! / BLOGS | SCIFITVSHOWS
’Vought Rising’: What To Know About The Boys Prequel, A Season 5 Link
Leo 2023 Showtimes Near Amc Merchants Crossing 16
Mayo Webscheduler
Schmidt & Schulta Funeral Home Obituaries
Best Charter Schools Tampa
Do you want to do a backbend?
Lorain County Busted Mugshots
NFL Week 1 coverage map: Full TV schedule for CBS, Fox regional broadcasts | Sporting News
So sehen die 130 neuen Doppelstockzüge fürs Land aus
Amazing Lash Bay Colony
Clarksville.craigslist
Tethrd Coupon Code The Hunting Public
Rantingly App
Spinning Gold Showtimes Near Mjr Westland Grand Cinema 16
Kristian Andersen | Scripps Research
Act3: Walkthrough | Divinity Original Sin 2 Wiki
Emojiology: 🤡 Clown Face
Bolly2Tolly Sale
Penn Foster 1098 T Form
Orbison Roy: (1936 1988) American Singer. Signed 7 X 9
Don Wallence Auto Sales Reviews
Oasis Buds Slime Rancher
Aeries Brea
William Sokol National Security Advisor Resigns
What Auto Parts Stores Are Open
Walmart Careers Application Part Time
Puppies For Sale in Netherlands (98) | Petzlover
Bronx Apartments For Rent Craigslist
Crime Times Louisville Ky Mugshots
C And B Processing
76 Games Unblocked Fnf
Research Tome Neltharus
Watch Stephen Miller Have A Full Meltdown When Asked To Back Up Crime Claim With Facts
Meggen Nut
Mugshots In Waco Texas
Hit Entertainment Wiki
The Crew 2 Cheats für PS4, Xbox One und PC ▷➡️
Saulr80683
Temperature At 12 Pm Today
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated:

Views: 6628

Rating: 4 / 5 (51 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.