1.0.5 • Published 10 years ago
@vaalentin/gl-context v1.0.5
GL Context
Get the WebGL context from a canvas.
Installation
$ npm install --save @vaalentin/gl-contextUsage
import getGl from '@vaalentin/gl-context';
const canvas = document.createElement('canvas');
const gl = getGl(canvas);
if(gl == null) {
// WebGL is not supported
}API
gl = getGl(canvas)
Returns the WebGL context from the canvas. If it fails, gl is null.
License
MIT, see LICENSE.md for more details.
Credits
Thanks to the amazing stackgl for the inspiration.