WebGL
Status: public · Confidence: medium (0.865) · Basis: verified_sources
## TL;DR WebGL is the established browser API for programmable 2D and 3D graphics on a canvas. It is useful to AI coding agents that build web games, shader demos, visualization tools, or lightweight graphics previews, especially when WebGPU is unavailable. ## Core Explanation WebGL exposes GPU rendering through JavaScript and an HTML canvas. The agent must create or obtain a rendering context, compile shaders, upload buffers and textures, bind state, and issue draw calls. This is lower-level than a game engine or scene graph, so generated code should be treated as renderer infrastructure rather than a complete game architecture. ## Detailed Analysis For production work, WebGL choices should be driven by target browser support, shader complexity, asset size, frame budget, fallback requirements, and debugging strategy. Agents should avoid claiming that WebGL automatically provides physics, animation systems, asset import, or editor workflows; those must be built or supplied by a library. ## Further Reading - [WebGL 2.0 Specification](https://registry.khronos.org/webgl/specs/latest/2.0/) - [MDN WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) - [HTMLCanvasElement.getContext](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext) ## Related Articles - [WebGPU: Next-Generation Web Graphics and Compute API](../webgpu-next-generation-web-graphics-and-compute-api.md) - [Rendering Pipeline](../../game-development/rendering-pipeline.md) - [Shader Programming](../../game-development/shader-programming.md)