OpenGL bindings & WebGL API implementation for Deno.
Note: WebGL API is WIP.
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/[email protected]/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-ffi
.
deno run -A --unstable-ffi <file>
Extensions:
- Babylon (Use
ext/babylon.ts
for an easy to use wrapper)
- Dj (@DjDeveloperr)
- Dean Srebnik (@load1n9)
Apache-2.0 licensed.
Copyright 2024 © The Deno Windowing Team