WebGL
A JavaScript API for rendering interactive 2D and 3D graphics in the browser
WebGL is a JavaScript API, based on OpenGL ES, that enables rendering interactive 2D and 3D graphics directly within a web browser's canvas element without requiring plugins, by giving scripts GPU-accelerated access through the HTML5…
Definition
WebGL is a JavaScript API, based on OpenGL ES, that enables rendering interactive 2D and 3D graphics directly within a web browser's canvas element without requiring plugins, by giving scripts GPU-accelerated access through the HTML5 canvas.
Overview
WebGL was introduced in 2011 by the Khronos Group as a way to bring hardware-accelerated graphics rendering to the web without native plugins like Flash or the earlier, now-defunct browser 3D plugins. It works by binding OpenGL ES 2.0 (WebGL 1.0) or OpenGL ES 3.0 (WebGL 2.0) semantics to a JavaScript API operating on the HTML `<canvas>` element's WebGL rendering context, letting developers write vertex and fragment shaders in GLSL and submit draw calls that execute on the GPU. WebGL exposes a relatively low-level, immediate-mode-adjacent graphics pipeline: developers manage buffers, textures, shaders, and render state explicitly, similar to native OpenGL programming. Because writing raw WebGL for complex scenes is verbose, most real-world usage goes through higher-level libraries built on top of it — Three.js and Babylon.js being the two most widely used — which provide scene graphs, cameras, materials, and lighting abstractions while ultimately issuing WebGL draw calls underneath. WebGL's browser support is nearly universal across modern desktop and mobile browsers, making it the long-standing default choice for browser-based 3D content: games, product configurators, data visualizations, CAD viewers, and creative-coding projects. Its 2.0 revision (based on OpenGL ES 3.0) added features like multiple render targets, 3D textures, and instanced rendering, closing some gaps with native mobile graphics capability. WebGPU is positioned as WebGL's eventual successor, offering lower driver overhead and first-class compute shader support, but as of the mid-2020s WebGL remains the safer, more universally compatible choice, and most production 3D web experiences still run on it, often via Three.js or Babylon.js.
Specification
- Hardware-accelerated 2D/3D rendering directly in the HTML5 canvas, no plugins required
- Based on OpenGL ES 2.0 (WebGL 1.0) and OpenGL ES 3.0 (WebGL 2.0)
- Shaders written in GLSL, executed on the GPU for vertex and fragment processing
- Near-universal support across modern desktop and mobile browsers
- Foundation for higher-level 3D libraries like Three.js and Babylon.js
- Explicit, low-level control over buffers, textures, and render pipeline state
- Widely used for games, data visualization, product configurators, and CAD viewers
Use Cases
Alternatives
History
WebGL brings hardware-accelerated 3D graphics to the browser without plug-ins by exposing a JavaScript binding to OpenGL ES 2.0. Its groundwork began in 2006 when Vladimir Vukićević prototyped a 3D context for the HTML canvas element; the Khronos Group formed a dedicated working group in 2009 and standardized the API on top of OpenGL ES 2.0. Khronos released the final WebGL 1.0 specification on March 3, 2011, at the Game Developers Conference, with backing from Apple, Google, Mozilla, and Opera, several of which were already shipping implementations. WebGL made real-time 3D — games, data visualization, mapping, and CAD — a native web capability, and it later gained a successor, WebGPU, for modern GPU access.
Sources
- Khronos Group — "Khronos Releases Final WebGL 1.0 Specification" (2011) · as of 2026-07-17
- Khronos Group — WebGL · as of 2026-07-17