---
title: "Custom Love.js with WebGL2"
date: "2026-01-11"
tags: ["programming","Love.js","WebGL2","Emscripten","wasm"]
---

# Custom Love.js with WebGL2

#### Overview

I created custom builds of Love2D and love.js to add WebGL2 support and more.

Working demo:

[▶ Play: bitmap-font-demo](https://kynantokoro.com/projects/bitmap-font-demo)

#### What I Did

#### 1. Custom LÖVE Build with WebGL2 Support

- Applied patches to Love2D for WebGL2 support and rebuilt with Emscripten.
- Resolved issues with font rendering
- With WebGL2 support, color representation has greatly improved.

#### 2. Two-Stage Asset Loading

In the old love.js, all assets were bundled into a single file that had to be loaded before startup.

I made it possible to split and load assets so that rendering can start as soon as possible.

I also created a mechanism for communication between JS ←> Lua needed for this. (I used a mechanism where signal files are written to MEMFS shared by JS/WASM and polled by Lua)

preload.data (immediate loading)

- All Lua files
- Loading screen assets
- Lightweight bitmap font (ASCII only)

game.data (asynchronous loading)

- Main game assets
- Large bitmap font (font with over 7000 characters including JIS Level 1 and JIS Level 2 kanji)
- Music and images

#### 3. Template Creation

Set up boilerplate code to recreate the texture of old games I love.



More details to come!
