Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Render graphics from Rust into JavaFX/AWT window

Ranch Hand
Posts: 146
Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got a small graphics processing application that I'm writing in Rust. It has various graphics backends (Metal, Vulkan, D3D) depending on the underlying OS. I'd like to create a simple application in Java (probably JavaFX but I could use AWT) as a proof of concept to allow a user to make simple tweaks to the graphics. However, I'm unsure about how to approach this interop. I don't want (or think I need to use LWJGL) because the Rust library handles this. What I really want is to:

1. Create a window.
2. Assign a portion of that window to be the render context for my Rust library.
3. Assign the other parts of that window to be my editing widgets.
4. Be able to detect mouse clicks in (2) to select rendered objects and alter them with (3).

I expect there is some amount of FFI work that needs to be done, which I know I'll need to look into. Where I'm really lost is how I hook up the graphics so that the Java app displays the rendered image and is able to process input.

Any thoughts or suggestions about how to procede?
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic