Get the Web Graphic Library context from a canvas.
$ npm install --save @ahmerhh/WebGraphicLibrary-context
import getGl from '@ahmerhh/WebGraphicLibrary-context';
const canvas = document.createElement('canvas');
const gl = getWebGLContext(canvas);
if(gl == null) {
// WebGraphicLibrary is not supported
}
Returns the WebGraphicLibrary
context from the canvas
. If it fails, gl
is null
.
MIT, see LICENSE.md for more details.
Thanks to the amazing stackgl for the inspiration.