# @kmamal/gl

> Fork of `gl` that can render to windows

Latest version **9.1.0** (published 2025-02-26) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install @kmamal/gl
pnpm add @kmamal/gl
yarn add @kmamal/gl
bun add @kmamal/gl
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; large bundle.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 9.1.0 |
| Published | 2025-02-26 |
| First published | 2021-03-17 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 6 |
| Unpacked size | 19.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 14 |
| Author | Mikola Lysenko |
| Maintainers | kmamal |
| Keywords | webgl, opengl, gl, headless, server, gpgpu |

## Links

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

## Dependencies (6)

- [nan](https://npm.io/package/nan.md) ^2.22.0
- [tar](https://npm.io/package/tar.md) ^7.4.3
- [node-abi](https://npm.io/package/node-abi.md) ^3.71.0
- [node-gyp](https://npm.io/package/node-gyp.md) ^11.1.0
- [bit-twiddle](https://npm.io/package/bit-twiddle.md) ^1.0.2
- [glsl-tokenizer](https://npm.io/package/glsl-tokenizer.md) ^2.1.5

## Recent versions

- 9.1.0 (latest) — 2025-02-26
- 10.0.0-3 (next) — 2026-10-25
- 10.0.0-2 — 2026-10-17
- 10.0.0-1 — 2026-10-04
- 10.0.0-0 — 2026-10-01
- 9.0.1 — 2025-02-22
- 9.0.0 — 2025-02-22
- 8.1.6-2 — 2025-01-21
- 8.1.6-1 — 2025-01-21
- 8.1.6-0 — 2025-01-20
- 8.0.2-6 — 2024-05-09
- 8.0.2-5 — 2024-05-07
- 8.0.2-4 — 2024-05-07
- 8.0.2-3 — 2024-05-07
- 8.0.2-2 — 2024-05-07
- … 10 more at https://npm.io/package/@kmamal/gl/versions

## README

# @kmamal/gl

This is a simple fork of the [`gl`](https://github.com/stackgl/headless-gl#readme) package that adds a single feature:
it can work together with [`@kmamal/sdl`](https://github.com/kmamal/node-sdl#readme) to allow WebGL drawing to actual windows.

It should work on Linux, Mac, and Windows.
Prebuilt binaries are available for x64 architectures, and arm-based Macs.

## Example

```js
const sdl = require('@kmamal/sdl')
const createContext = require('@kmamal/gl')

const window = sdl.video.createWindow({
  title: "Hello, World!"
  opengl: true,
})

// Clear screen to red
const { width, height, native } = window
const gl = createContext(width, height, { window: native })
gl.clearColor(1, 0, 0, 1)
gl.clear(gl.COLOR_BUFFER_BIT)
gl.swap()
```

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