JSPM

gl-context

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21
  • Score
    100M100P100Q57206F
  • License MIT

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

Package Exports

  • gl-context

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gl-context) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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.