Kotlin/JS WebGL2 Support?

Hi,

I am currently using Kotlin/JS + WebGL – which has been great – the typed interface is really nice.

However, I would like to use webgl2 features. Is this supported at all by Kotlin/JS ?

I tried .getContext(“webgl”) → .getContext(“webgl2”) … but then, I can no longer cast it to a WebGLR3enderingContext

Is WebGL2 support coming? Is there an expected time?

Thanks!

1 Like

6 years late I know… But I’m hitting the same problem. I don’t think it’s solved yet.

I solved it manually by adding the missing class, and that is not hard at all. I made a file WebGL2RenderingContext.kt which contains just a copy of the WebGLRenderingContext class, with just the class name changed to add the ‘2’. This has been working well for me, though I haven’t been using anything in Kotlin using this, only used it for the newer GLSL language.

If you need methods on the WebGL2 object that don’t exist on the WebGL1 I expect you can simply declare them so they get bridged to the javascript version.