RepositoryOdinPLPoland
thetarnav

thetarnav/odin-wasm

Odin + WASM = 💙

142stars
4forks
1issues
10views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: odin-lang

#1 Repository of the month

1
TINIX TRENDING·Topic: odin

#1 Repository of the month

3
TINIX TRENDING·Topic: webgl

#3 Repository of the month

Odin WASM

For using Odin and WASM together.

demo gif

What is this?

1. A library of WASM bindings

A library of wasm bindings from Odin/vendor/wasm implemented using modern JavaScript with ES modules and JSDoc.

The implementation is mostly the same as the original, here are the differences:

  • ESM - the bindings are written in multiple ES modules, mirroring Odin packages, so they need to be used in a modern JS environment, assuming that the user will use a bundler like Webpack or Rollup to bundle the code, and tree-shake the unused parts.
  • JSDoc - the original bindings are witout types, so I added JSDoc comments to the functions for basic typechecking (and some autocompletion).
  • Improvements to getting window position and size
  • ctx2d - Bindings to the 2d canvas context, for drawing 2d graphics without webgl.
  • ls - Bindings to the localStorage API, for saving data in the browser.

2. Odin + WASM example

thetarnav.github.io/odin-wasm

In example/ you can find an example of how to use Odin and WASM together. Mainly focused on WebGL as I'm going through the WebGL Fundamentals tutorial.

3. A template repo

Feel free to use this repo as a template for your own projects.

There are some convenience scripts in main.js for building and running the example. And a github action for building and deploying the example to github pages.

4. GLSL utils codegen tool

The /shdc directory contains a cli tool for generating GLSL utils from parsing glsl shaders in the example/ dir.

It can be ran with npm run shdc, or odin run shdc.

The generated file is committed to the repo, you can check it out in example/shaders_generated.odin.

The tool is just an experiment of parsing glsl, and generating some boilerplate code, so that getting attribute and uniform locations, and setting the values is a bit easier.

Development

Dependencies

OLS

Add js_wasm32 target to ols.json if you want to use OLS.

{
    "enable_format": false,
	"checker_args": "-target:js_wasm32 -vet-unused -vet-style -vet-semicolon -vet-cast -vet-tabs",
	"profile": "example",
	"profiles": [{
		"name": "example",
		"os": "js_wasm32",
		"checker_path": ["example"]
	}, {
		"name": "shdc",
		"checker_path": ["shdc"]
	}, {
		"name": "obj",
		"checker_path": ["obj"]
	}]
}

Scripts

Take look at package.json for all the available scripts.

(You need to run npm i beforehand)

The most important ones are:

  • npm run dev - starts the server and watches for changes
  • npm run build - builds the example to dist/
  • npm run preview - starts a server to preview the built example
  • npm run shdc - generates shader utils from parsing glsl shaders

Similar Projects

Discover other similar projects and AI models.

RepositoryJavaScript
mrdoob/three.js

JavaScript 3D Library.

120.1k
Dec 2, 2026
RepositoryJavaScript
mrdoob/three.js

JavaScript 3D Library.

120.1k
Dec 2, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

487.0k
Dec 2, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

459.9k
Dec 2, 2026
RepositoryPython
practical-tutorials/project-based-learning

Curated list of project-based tutorials

290.9k
Nov 30, 2026
RepositoryJavaScript
react/react

The library for web and native user interfaces.

253.0k
Nov 30, 2026
RepositoryTypeScript
vuejs/vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

212.6k
Oct 10, 2024
RepositoryJavaScript
trekhleb/javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

196.8k
Jul 26, 2026
Repository
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

184.8k
Oct 31, 2026