You are currently viewing Experiment to make OpenGL work together with Jetpack Compose

Experiment to make OpenGL work together with Jetpack Compose

I am making this post just to point out that it is possible but a bit heavy to do :).

For experimental purpose, I managed to initialize Jetpack Compose purely by OpenGL context.

In points to get such integration I had to do:

1) initialization of the window and graphics context, here I have chosen OpenGL via GLFW

2) initialization of a Skija context from a previously created Opengl context

3) creating a UI thread e.g looper like in Android and implementing a new dispatcher for coroutines

4) integrating jetpack-compose with UI thread, Skija context and inputs coming from GLFW

5) copy and modify more than 60 internal classes in jetpack compose(the most tough point)

And here is OpenGL/Jetpack Compose(Skija)/imgui-java drawing together.

https://preview.redd.it/hpt7hq7ma2c71.png?width=1920&format=png&auto=webp&s=917829fc9e907de55da0bcf4453677ee7788d609

So if anyone is wondering, it is certainly possible to integrate OpenGL with Jetpack Compose, the question is whether it is worth it :).

submitted by /u/Illithidek
[link] [comments]