gl-context
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 = 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.