Skip to main content

Deno Gluten

Tags Doc License Sponsor

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 handles both).

// GLES2 3.2 API
import * as gl from "https://deno.land/x/gluten@0.1.0/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 for some usage examples.

Since this module depends on unstable FFI API, you need to pass --unstable along with --allow-ffi.

deno run --unstable --allow-ffi <file>

Maintainers

License

Apache-2.0 licensed.

Copyright 2023 © The Deno Windowing Team