webgl-to-canvas2d
v1.1.0
Published
Convert a webgl context or webgl canvas into a 2d canvas
Downloads
18
Readme
webgl-to-canvas2d
Convert a webgl context or a webgl canvas into a 2d canvas.
Usage
webglToCanvas2d(gl, [canvas2d])
gl
can be a canvas using webglrenderingcontext or a webglrenderingcontext.
canvas2d
can be a canvas or a CanvasRenderingContext2D.
The returned value will be a canvas using CanvasRenderingContext2D.
var webglToCanvas2d = require('webgl-to-canvas2d');
var glCanvas = document.body.appendChild(document.createElement('canvas'));
var gl = require('gl-context')(glCanvas, {preserveDrawingBuffer: true});
var canvas2d;
// RENDER SOME STUFF
canvas2d = webglToCanvas2d(glCanvas);
// or
canvas2d = webglToCanvas2d(gl);
License
MIT, see LICENSE.md for details.