Is it possible to wrap a native view with desktop ...
# compose-desktop
e
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
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
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