Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

gl-context

hughsk121MIT0.1.1

A shorthand module for creating a new WebGL context and basic animation loop.

gl, webgl, context, simple, browserify

readme

gl-context stable

A shorthand module for creating a new WebGL context and basic animation loop.

Normally I'd recommend gl-now, but this is for those cases when you want more flexibility.

Usage

gl-context

gl = createContext(canvas, [opts], [render])

Creates and returns a new WebGL context attached to canvas. Optionally, you can pass in a render function and this will be called once each frame using requestAnimationFrame.

Optionally, you can pass opts to the getContext method, e.g.

var canvas = document.createElement('canvas')

var gl = createContext(canvas, {
  premultipliedAlpha: false
}, function render() {
  // render loop...
})

License

MIT. See LICENSE.md for details.