Skip to content

imconnorngl/node-canvas-webgl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-canvas-webgl

Integration of node-canvas and headless-gl.

Demo:

const width = 512;
const height = 512;

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);

const canvas = createCanvas(width, height);

const renderer = new THREE.WebGLRenderer({ canvas: canvas as unknown as HTMLCanvasElement });

const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({color: 0x00ff00});
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);

camera.position.z = 5;

renderer.render(scene, camera);

canvas.createPNGStream().pipe(createWriteStream(join(snapshotsPath, 'create-threejs-scene.png')));

About

Integration of node-canvas and headless-gl.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 70.6%
  • TypeScript 29.4%