Give the browser a drawing surface
The HTML canvas is the rectangle on the page. WebGL gives JavaScript access to the GPU through that canvas. This demo uses WebGL 1 directly, with no graphics framework. Its temporary Canvas 2D surface creates the letters; the visible cube is rendered with WebGL.
Try it: drag the cube above. You are moving a real 3D model, not swapping between pictures.
var gl = canvas.getContext("webgl", {
alpha: false,
antialias: true,
depth: true,
stencil: false
}) || canvas.getContext("experimental-webgl");
if (!gl) {
showError("WebGL isn't available in this browser.");
return;
}
// --- glyph atlas -------------------------------------------------------