Skip to content
BENIBIX Learn

WebGL

Design🧊 3D & Immersive3D Tools

Also known as Web Graphics Library, WebGL 2

A web standard that lets pages draw 3D with the graphics card. No plug-in is needed.

Think of it like

It is like a back door from a web page straight to the graphics card.

Example

A car maker's site lets visitors spin a 3D car and change its paint. WebGL draws each frame in the browser.

Why it matters

It is why 3D product viewers, maps and games can run inside a normal web page.

Definition

WebGL is a web standard that lets a page draw 3D graphics using the device's graphics card. No plug-in is needed. It draws into a canvas element on the page. Its code is low level, so most people use a library on top of it instead of writing it by hand. The Khronos Group released version 1.0 in March 2011, and every major browser supports it. A newer standard, WebGPU, is starting to take over some of its work.

Example code

javascript
const canvas = document.querySelector("canvas");
const gl = canvas.getContext("webgl");
console.log(gl ? "WebGL is ready" : "No WebGL here");
The page asks the canvas for a WebGL drawing context and checks that it got one.
WebGL is the step that hands the drawing to the graphics card.

Common mistake

Assuming every device draws it well. Old phones struggle, so plan a simple backup.

Key takeaways

  1. 1
    Graphics card from the web. No plug-in.
  2. 2
    Draws into a canvas. Part of the page.
  3. 3
    Low level. Usually used through a library.