@drawcall/webgl
v0.1.0
Published
Headless WebGL2 for Node.js on every machine, rendered on the CPU by ANGLE and Mesa lavapipe
Readme
@drawcall/webgl
Headless WebGL2 for Node.js that renders three.js scenes on any machine, including small VMs without a GPU, with nothing to install beyond npm install. Rendering runs on the CPU through ANGLE and Mesa's lavapipe, the same WebGL implementation Chrome is built on, so images match Chrome's.
npm install @drawcall/webgl threeimport * as THREE from "three";
import { createCanvas, installGlobals } from "@drawcall/webgl";
installGlobals(); // createImageBitmap & co. for three.js loaders
const canvas = createCanvas(1280, 720);
const renderer = new THREE.WebGLRenderer({ canvas });
renderer.render(scene, camera);
const pixels = canvas.readPixels(); // RGBA, top row firstSupports macOS (arm64, x64), Windows (x64) and Linux (x64, arm64, glibc 2.28+). See skills/webgl for details.
