# @vaalentin/gl-context

> Get the WebGL context from a canvas.

Latest version **1.0.5** (published 2016-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vaalentin/gl-context
pnpm add @vaalentin/gl-context
yarn add @vaalentin/gl-context
bun add @vaalentin/gl-context
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2016-02-05 |
| First published | 2016-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vaalentin |
| Maintainers | vaalentin |
| Keywords | WebGL, context, canvas |

## Links

- npm: https://www.npmjs.com/package/@vaalentin/gl-context
- Repository: https://github.com/vaalentin/gl-context
- Homepage: https://github.com/vaalentin/gl-context#readme
- Issues: https://github.com/vaalentin/gl-context/issues
- npm.io page: https://npm.io/package/@vaalentin/gl-context

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2016-02-05
- 1.0.4 — 2016-02-05
- 1.0.3 — 2016-02-05
- 1.0.2 — 2016-01-16
- 1.0.1 — 2016-01-08
- 1.0.0 — 2016-01-07

## README

# GL Context

Get the WebGL context from a canvas.

## Installation

```sh
$ npm install --save @vaalentin/gl-context
```

## Usage

```js
import getGl from '@vaalentin/gl-context';

const canvas = document.createElement('canvas');
const gl = getGl(canvas);

if(gl == null) {
  // WebGL is not supported
}
```

## API

#### `gl = getGl(canvas)`

Returns the `WebGL` context from the `canvas`. If it fails, `gl` is `null`.

## License

MIT, see [LICENSE.md](https://github.com/vaalentin/gl-context/blob/master/LICENSE.md) for more details.

## Credits

Thanks to the amazing [stackgl](http://stack.gl/) for the inspiration.

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