Render an interactive 3D scene in a browser using custom GLSL shaders without learning a heavy framework like Three.js.
Build a full-screen generative art or visual effect using a fragment shader, skipping the scene graph entirely.
Learn WebGL fundamentals by studying OGL's annotated examples and source code while building something real.
Requires knowledge of GLSL shader programming, OGL does not abstract away the GPU programming layer.
OGL is a minimal WebGL library for JavaScript developers who want to write their own shaders with few abstractions between their code and the browser's graphics layer. WebGL is the browser API for drawing 3D graphics on a webpage. OGL wraps just enough of that API to make it usable without burying the developer in framework-level decisions. The library is split into three parts: Math (matrix and vector math, about 6KB compressed), Core (the fundamental building blocks like geometry, cameras, and meshes, about 8KB compressed), and Extras (additional features that go beyond the core, about 15KB compressed). The total minified-and-gzipped size is roughly 29KB, and with tree-shaking during a build step the final bundle gets much smaller. There are zero external dependencies. Installing is a standard npm or yarn install. You can also load it from a CDN such as jsDelivr, unpkg, or Skypack. The API shares many similarities with ThreeJS, but OGL is more tightly coupled to raw WebGL, which means you can freely mix OGL code with native WebGL commands without the library getting in the way. The design philosophy is to do the minimum abstraction necessary. A basic example from the README renders a spinning white cube using a renderer, a camera, a box geometry, a shader program written in GLSL, and a mesh. For simpler uses like full-screen shader effects, you can skip the camera and scene graph entirely. The README includes both examples with working code. The examples on the project's website are intended as the primary learning resource, with comments in the source explaining each technique. Because the library stays close to the underlying WebGL layer, it also works as a practical way to learn WebGL while building something real. The code is released into the public domain with no restrictions on use or modification.
← oframe on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.