https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
e

Eric O'Connell

03/10/2023, 5:44 AM
Is it possible to wrap a native view with desktop compose? On Mac, I’d like to host an MTKView and hook up a MoltenVK renderer but drive the UI with compose. Also, whatever the equivalent of that would be on Windows 😂 ..
I already do the equivalent on Android, using SurfaceView, but I realize this is more involved :)
a

Alexander Maryanovsky

03/10/2023, 6:36 AM
I don’t know whether or how, but you can try something with JAWT: https://docs.oracle.com/en/java/javase/19/docs/specs/AWT_Native_Interface.html
and embed it using SwingPanel
e

ephemient

03/10/2023, 7:11 AM
JavaFX has https://javadoc.io/static/org.openjfx/javafx-fxml/17/javafx.graphics/javafx/scene/image/PixelBuffer.html if you can render your Vulkan into an offscreen buffer, use that to bring it into JavaFX, and then bridge JavaFX to Swing, I'd expect that to be more performant than Canvas as there's only one software copy involved
unfortunately I don't think there's a way to avoid the copy like SurfaceView
31 Views