What WebGL is
WebGL closely follows OpenGL ES 2.0, a graphics interface for mobile and embedded devices. WebGL 2 is based on OpenGL ES 3.0 and adds features such as 3D textures and uniform buffer objects [1]. All modern browsers support WebGL, though the device also needs suitable graphics hardware [1].
How it is used
WebGL on its own is very low-level: create buffers, write shaders, issue draw commands. In practice almost every project uses a library such as three.js or Babylon.js that handles scenes, materials, cameras and glTF loading.
Limits worth knowing
- GPU memory: large textures and many models can exhaust a phone's memory.
- Context loss: the browser can lose a page's WebGL context, for example after a GPU driver reset or when resources run short; it reports this with the
webglcontextlostevent [3]. A good application catches it and restores the view. - Draw calls: many small draw calls slow things down; fewer, larger ones are generally faster [2].
- No further core development: new graphics features arrive mainly in WebGPU.
Relevance to configurators
Our example configurators render with the three.js WebGL renderer. The spiral stair configurator (example configurator, fictional product) catches a context loss, shows a notice and restores the view without losing the visitor's selection.
Whether a new project should use WebGL or WebGPU is covered in the WebGPU entry.
The 3D product viewer page explains how a model gets onto your site.