Stuck trying to run a webgl library with Kotlin/JS

Hi. I write opengl Kotlin code almost daily but I’m completely new to Kotlin/JS.

  1. I created a Kotlin/JS project in Idea without React. The hello world works fine.
  2. I added implementation(npm("pixi.js", "5.3.3", generateExternals = true)) to build.gradle.kts ; pixi.js is a webgl library developed in TypeScript.
  3. I ran dukat > generateExternals in gradle
  4. I wrote some simple Kotlin code:
import kotlinx.browser.document
import kotlinx.browser.window
import kotlinx.html.dom.append
import org.w3c.dom.Node

fun main() {
    window.onload = { document.body?.addPixi() }

fun Node.addPixi() {
    val app = PIXI.Application()
    val graphic = PIXI.Graphics()
    graphic.lineStyle(3, 0xFF00FF)
    graphic.drawCircle(0, 0, 100)
    append {

I get hundreds of errors in lib.dom.kt, most of them are of the type 'addEventListener' overrides nothing.

I don’t find in this forum mentions to either three.js or pixi.js, probably the most popular webgl libraries. Has anyone worked with them succesfully in Kotlin/JS?

Any tips on how to get it working? Or should I stick to JavaScript for now? Thank you :slight_smile:

There seems to be a solution for those working on three.js:

VisionForge uses a full ThreeJs wrapper: Initial bindings were developed by @laht90 and were copied and somewhat fixed by me. You are free to use it. I do not intend to maintain separate wrappers right now, but if there is enough interest, and someone is willing to do so, we can move it to a separate project.