Repolode
regl-project

regl-project/regl

A functional WebGL wrapper that removes shared GPU state, letting you describe draw calls as commands and compile them into optimized JavaScript.

Stars
5,595
Forks
329
Open issues
127
Last commit
22 days ago

What is it?

regl is a JavaScript library that wraps the WebGL API with two abstractions: resources, which are handles to GPU objects such as buffers, textures and framebuffers, and commands, which fully describe the WebGL state needed for a draw call. Developers mix static and dynamic values when defining a command, and regl generates optimized JavaScript code from that description, so most of the per-call overhead of raw WebGL is avoided.

The library is intentionally minimal. It does not provide a scene graph, a game engine or vector math utilities; any WebGL feature, including extensions such as multiple render targets and instancing, remains accessible. It has no dependencies, ships a standalone script build alongside the npm package, and includes a large test suite with validation checks enabled in development mode.

Key features

  • 01Wraps WebGL with resource and command abstractions to reduce shared state.
  • 02Compiles command definitions into optimized JavaScript via partial evaluation.
  • 03Automatically unrolls nested arrays into typed arrays for buffers.
  • 04Provides regl.frame for requestAnimationFrame with viewport handling.
  • 05Exposes all WebGL features, including extensions like instancing.
  • 06Has no runtime dependencies and offers a standalone script build.

Use cases

  • Building custom GPU-accelerated data visualizations in the browser.
  • Writing shader-based graphics or simulations that need direct WebGL control.
  • Creating long-lived web applications that depend on a stable, low-level rendering API.

Quick start

  1. 1

    Install regl from npm into your project

    npm i -S regl
  2. 2

    Require regl and create an instance, then draw with regl.frame

Things to know

  • Development-mode error checks are removed when bundled with browserify unless you use the --debug flag.

In collections

Topics

FAQ

What is regl?
A functional WebGL wrapper that removes shared GPU state, letting you describe draw calls as commands and compile them into optimized JavaScript. regl is a JavaScript library that wraps the WebGL API with two abstractions: resources, which are handles to GPU objects such as buffers, textures and framebuffers, and commands, which fully describe the WebGL state needed for a draw call. Developers mix static and dynamic values when defining a command, and regl generates optimized JavaScript code from that description, so most of the per-call overhead of raw WebGL is avoided.
Is regl free to use? What license does it have?
regl is open source under the MIT license. Check the license terms before using it in commercial products.
Is regl still maintained?
Actively maintained. The last commit to regl was on Oct 17, 2026.
What can I use regl for?
Building custom GPU-accelerated data visualizations in the browser. Writing shader-based graphics or simulations that need direct WebGL control. Creating long-lived web applications that depend on a stable, low-level rendering API.
How do I install regl?
Install regl from npm into your project: npm i -S regl Require regl and create an instance, then draw with regl.frame
Where can I get regl?
The source code and installation instructions are on GitHub: https://github.com/regl-project/regl

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects