I'm trying to render an OpenGL scene to a Canvas t...
# compose-desktop
z
I'm trying to render an OpenGL scene to a Canvas to be embedded in compose, but I can't figure out how to. I've seen the LWGJL compose desktop example but that's rendering compose content to a GLFW window, which is the opposite of what I want. Could I maybe get some guidance in what direction I need to go to do this?
r
The simplest way I can think of it to go through an AWTGLCanvas you embed in Compose using a SwingPanel
(Compose's Canvas won't let you render with GL into it directly)
f
@zt Could you tell me what example are you referring to? I'm looking for a way to render Compose to a GLFW window! The example I found renders lwjgl to awt which doesn't work well.
Oh I think it might be this https://github.com/JetBrains/compose-multiplatform/blob/master/experimental/lwjgl-integration/src/main/kotlin/main.kt This example renders opengl to awt: https://github.com/vitorscoelho/compose-lwjgl-example But that approach doesn't let you draw opengl on top of a ComposePanel (or any panel, even when it is transparent). It's an issue with the opengl-awt library that is badly maintained in general.