@vaalentin/gl-context

1.0.5 • Public • Published

GL Context

Get the WebGL context from a canvas.

Installation

$ npm install --save @vaalentin/gl-context

Usage

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.

Readme

Keywords

Package Sidebar

Install

npm i @vaalentin/gl-context

Weekly Downloads

1

Version

1.0.5

License

MIT

Last publish

Collaborators

  • vaalentin