Skip to content

hughsk/gl-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors