Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src 0.0.8 bump Mar 20, 2019
binding.gyp Update include path Mar 20, 2019
tsconfig.json Initial commit. Oct 30, 2018
yarn.lock Yalc and npm ignore Jan 14, 2019

Headless WebGL / OpenGL ES runtime for Node.js

This repo is under active development and is not production-ready. We are actively developing as an open source project.


This project aims to provide a headless runtime for WebGL and OpenGL ES shaders under Node.js. This package will use the ANGLE engine to translate WebGL and OpenGL ES shaders to the target runtime. Please see the ANGLE project for more details on support.

Future plans include surfacing an API for running Compute Shaders and a OpenGL ES API. Patches are welcome!

Supported platforms

  • Mac OS
  • Windows
  • Linux

Creating a WebGL context

To create a new WebGLRenderingContext or WebGL2RenderingContext - simply include the package and call createWebGLRenderingContext():

const nodeGles = require('node-gles');

const gl = nodeGles.createWebGLRenderingContext();

// Now, use `gl` for regular WebGL calls:
const tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

Run demo

Clone this repo for current demos - examples coming soon

  • Float32 texture upload and download:
$ yarn ts-node src/tests/float_texture_upload_test.ts

buffer:  Float32Array [ 0.5, 1.5, 2.5, 3.5 ]
  • Float16 texture upload and download:
$ yarn ts-node src/tests/half_float_texture_upload_test.ts

buffer:  Float32Array [ 0.5, 1.5, 2.5, 3.5 ]
  • Unsigned byte texture upload and download:
$ yarn ts-node src/tests/unsigned_byte_texture_upload_test.ts

buffer:  Uint8Array [ 1, 2, 3, 4 ]


Build instructions are under heavy development and will include an Angle binary

This project currently requires ANGLE to be checked out and built in the same parent folder as this repo. Checkout and build ANGLE with the Debug setup. After ANGLE is built, run yarn for this project.

You can’t perform that action at this time.