# gl-context

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

Latest version **0.1.1** (published 2014-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install gl-context
pnpm add gl-context
yarn add gl-context
bun add gl-context
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-09-14 |
| First published | 2014-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Hugh Kennedy |
| Maintainers | hughsk |
| Keywords | gl, webgl, context, simple, browserify |

## Links

- npm: https://www.npmjs.com/package/gl-context
- Repository: https://github.com/hughsk/gl-context
- Issues: https://github.com/hughsk/gl-context/issues
- npm.io page: https://npm.io/package/gl-context

## Dependencies (1)

- [raf-component](https://npm.io/package/raf-component.md) ^1.1.2

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-09-14
- 0.1.0 — 2014-05-24
- 0.0.0 — 2014-05-13

## README

# gl-context [![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

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

Normally I'd recommend [gl-now](http://github.com/gl-modules/gl-now), but this
is for those cases when you want more flexibility.

## Usage

[![gl-context](https://nodei.co/npm/gl-context.png)](https://nodei.co/npm-dl/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.

``` javascript
var canvas = document.createElement('canvas')

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

## License

MIT. See [LICENSE.md](http://github.com/hughsk/gl-context/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/gl-context · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
