https://github.com/deno-windowing/gluten
OpenGL bindings & WebGL API implementation for Deno.
https://github.com/deno-windowing/gluten
deno ffi gpu opengl typescript webgl
Last synced: 8 months ago
JSON representation
OpenGL bindings & WebGL API implementation for Deno.
- Host: GitHub
- URL: https://github.com/deno-windowing/gluten
- Owner: deno-windowing
- License: apache-2.0
- Created: 2022-11-08T13:38:19.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-04T15:45:16.000Z (over 1 year ago)
- Last Synced: 2025-09-10T13:45:03.400Z (10 months ago)
- Topics: deno, ffi, gpu, opengl, typescript, webgl
- Language: TypeScript
- Homepage: https://deno.land/x/gluten
- Size: 1.59 MB
- Stars: 52
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deno Gluten
[](https://github.com/deno-windowing/gluten/releases)
[](https://doc.deno.land/https/deno.land/x/gluten/mod.ts)
[](https://github.com/deno-windowing/gluten/blob/master/LICENSE)
[](https://github.com/sponsors/DjDeveloperr)
OpenGL bindings & WebGL API implementation for Deno.
Note: WebGL API is WIP.
## Usage
Import native OpenGL from `/api/gl[es|es2]{version}.ts`.
All the functions map 1:1 with the C OpenGL API.
Extensions are present in `/api/ext/*`.
Before using the API, make sure to create OpenGL context and load function
pointers using `load` function exported, which accepts a `getProcAddress`
callback ([DWM](https://github.com/deno-windowing/dwm) handles both).
```ts
// GLES2 3.2 API
import * as gl from "https://deno.land/x/gluten@0.1.8/api/gles23.2.ts";
// Initialize function pointers
gl.load(yourGetProcAddress);
// ... Initialize context (for example using DWM)
// Use APIs from `gl` i.e. gl.DrawElements(...)
```
For using WebGL, `mod.ts` exports `WebGLCanvas` which handles both window and
context creation.
Check [./examples](./examples/) for some usage examples.
Since this module depends on unstable FFI API, you need to pass
`--unstable-ffi`.
```sh
deno run -A --unstable-ffi
```
Extensions:
- [Babylon](https://www.babylonjs.com/) (Use `ext/babylon.ts` for an easy to use
wrapper)
## Maintainers
- Dj ([@DjDeveloperr](https://github.com/DjDeveloperr))
- Dean Srebnik ([@load1n9](https://github.com/load1n9))
## License
[Apache-2.0](./LICENSE) licensed.
Copyright 2024 © The Deno Windowing Team