Skip to content

Experience-Monks/webgl-to-canvas2d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webgl-to-canvas2d

stable

Convert a webgl context or a webgl canvas into a 2d canvas.

Usage

NPM

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.

About

Convert a webgl context or webgl canvas into a 2d canvas

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published