Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
A basic WebGL program in JavaScript that renders a triangle to a canvas element.
# webgl/demo/triangle.js
const canvas = document.getElementById('canvas');
const gl = canvas.getContext('webgl');
// Setup shaders, buffers, and render a triangle
// ... shader setup and buffer code ...
gl.drawArrays(gl.TRIANGLES, 0, 3);WebGL (Web Graphics Library) is a low-level JavaScript API for rendering high-performance 2D and 3D graphics in the browser using the GPU. It provides a JavaScript binding to OpenGL ES, allowing hardware-accelerated graphics without plugins.
Origin & Creator
WebGL was developed by the Khronos Group, the same industry consortium behind OpenGL, Vulkan, and WebGPU. The first final specification (WebGL 1.0) was released on March 3, 2011, with precursor work starting around 2006 at Mozilla as a Canvas 3D experiment.
Industrial Note
WebGL is widely used in scientific visualization, CAD tools, GIS mapping, medical imaging, and 3D configurators for industries like automotive and e-commerce.