# OGL

> Minimal WebGL library (about a tenth of three.js) for custom shader effects.

Source: https://tastebase.ehsanulsiam.workers.dev/browse/ogl

free

Minimal WebGL library (about a tenth of three.js) for custom shader effects.

by Nathan Gordon[GitHub](https://github.com/oframe/ogl)[npm](https://npmjs.com/package/ogl)

[visit](https://oframe.github.io/ogl/?utm_source=tastebase&utm_medium=referral&utm_content=detail-page)

[https://oframe.github.io/ogl/](https://oframe.github.io/ogl/?utm_source=tastebase&utm_medium=referral&utm_content=detail-preview)

## Try these

no preview

### [three.js](https://tastebase.ehsanulsiam.workers.dev/browse/three)

The standard WebGL and WebGPU 3D engine: scenes, cameras, materials, loaders.

no preview

### [Paper Shaders](https://tastebase.ehsanulsiam.workers.dev/browse/paper-shaders)

Zero-dependency WebGL shader backgrounds: mesh gradients, grain, dithering, liquid metal and more.

no preview

### [React Bits](https://tastebase.ehsanulsiam.workers.dev/browse/react-bits)

200+ free animated React components, text effects and backgrounds in JS/TS and CSS/Tailwind flavours.

no preview

### [Recharts](https://tastebase.ehsanulsiam.workers.dev/browse/recharts)

Composable SVG charts for React; the engine behind shadcn/ui charts.

## Looks that pick it

[Neon / cyber](https://tastebase.ehsanulsiam.workers.dev/looks/neon)[Holographic](https://tastebase.ehsanulsiam.workers.dev/looks/holographic)[Cyberpunk](https://tastebase.ehsanulsiam.workers.dev/looks/cyberpunk)[Synthwave](https://tastebase.ehsanulsiam.workers.dev/looks/synthwave)[Sci-fi HUD](https://tastebase.ehsanulsiam.workers.dev/looks/sci-fi-hud)[Acid graphics](https://tastebase.ehsanulsiam.workers.dev/looks/acid)[Game UI](https://tastebase.ehsanulsiam.workers.dev/looks/game-ui)

## For your agent

##### Install

`npm i ogl`

##### Use it for

- a single full-screen fragment shader background you write yourself
- lightweight WebGL hover or distortion effects on images
- porting React Bits-style shader backgrounds without pulling in three.js

##### Skip it when

- you want a ready-made gradient or texture: use paper-shaders
- real 3D scenes with models, lights and controls: use r3f or three

##### What's inside35 free

- Renderer
- Camera
- Transform
- Mesh
- Geometry
- Program
- Texture
- RenderTarget
- Math (Vec, Mat, Quat, Euler, Color)
- Plane
- Box
- Sphere
- Cylinder
- Torus
- Triangle
- Orbit
- Raycast
- Curve
- Path
- Tube
- Polyline
- Post
- Flowmap
- GPGPU
- Shadow
- Text
- Skin
- Animation
- InstancedMesh
- GLTFLoader
- TextureLoader
- KTXTexture
- WireMesh
- AxesHelper
- GridHelper

##### Facts

**Frameworks**
vanilla, react, vue, svelte, solid, angular

**Styling**
unstyled

**Weight**
small

**Accessibility**
n/a

**Maturity**
stable

**License**
Unlicense

**Price**
Free

##### Pairs with

[React Bits](https://tastebase.ehsanulsiam.workers.dev/browse/react-bits)

##### Alternatives

[three.js](https://tastebase.ehsanulsiam.workers.dev/browse/three)[Paper Shaders](https://tastebase.ehsanulsiam.workers.dev/browse/paper-shaders)

[Compare OGL with its alternatives](https://tastebase.ehsanulsiam.workers.dev/alternatives/ogl-alternatives)

```
import { Renderer, Program, Mesh, Triangle } from 'ogl'

const el = document.getElementById('bg')!
const renderer = new Renderer({ dpr: Math.min(devicePixelRatio, 2) })
const gl = renderer.gl
el.appendChild(gl.canvas)
renderer.setSize(el.clientWidth, el.clientHeight)

const program = new Program(gl, {
  vertex: `attribute vec2 position; void main() { gl_Position = vec4(position, 0., 1.); }`,
  fragment: `precision highp float; uniform float uTime; void main() { gl_FragColor = vec4(0.5 + 0.5 * sin(uTime + gl_FragCoord.xxy / 200.), 1.); }`,
  uniforms: { uTime: { value: 0 } },
})
const mesh = new Mesh(gl, { geometry: new Triangle(gl), program })

requestAnimationFrame(function loop(t) { program.uniforms.uTime.value = t / 1000; renderer.render({ scene: mesh }); requestAnimationFrame(loop) })
```

https://oframe.github.io/ogl/examples/

Loading website

[Visit](https://oframe.github.io/ogl/?utm_source=tastebase&utm_medium=referral&utm_content=floating-pill)
