nogl

WebGL shim for node

Usage no npm install needed!

<script type="module">
  import nogl from 'https://cdn.skypack.dev/nogl';
</script>

README

WebGL context minimal shim for node. Useful to make stackgl components not fail in node.

npm install nogl

var Shader = require('gl-shader');
var gl = require('nogl')();
var glslify = require('glslify-sync');
var createProcessor = require('nogl-shader-output');

var shader = Shader(gl, glslify('./vertex.glsl'), glslify('./fragment.glsl'));

var draw = createProcessor(shader);

draw({
    size: [10, 20]
});

API is compatible with webgl-context. If you need real webgl, use headless-js. For practical use-case look nogl-shader-output. Heavily inspired by emscripten headlessCanvas.