I want to write an application that runs with two different windows, one with JavaFX (v18) and one with Processing (v4). I'm on Linux 64-bit using IntelliJ-Idea as IDE and Maven to manage dependencies. The project is created as a JavaFX project and the processing.core
library is added as a separate project library.
I spent A LOT of TIME understanding how to set up the project correctly and I succeeded in launching a simple JFX app that creates a new window where a 2D sketch runs fine (a circle that follows the mouse's coordinates).
The problem comes out when I try to launch a 3D sketch (because that's what i need for my application) with the P3D render and I receive an exception with:
java.lang.UnsatisfiedLinkError: Can't load library: /home/.../natives/linux-amd64/libgluegen_rt.so
As suggested here I already tried to solve adding the jogl-fat.jar
library as a project's library or dependencies for the jogl libraries from maven, without effects.
I don't think that something is wrong with my code but it's Processing or JFX's fault. PS: I have to use processing to make a 3D environment for simulation, but I don't have restrictions for JavaFX. If someone knows another framework that can let me launch a P3D sketch and interact with it with some controls (i.e. buttons), you are welcome!
This is an example of the java classes that I have:
public class HelloApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
public class ProcessingTest extends PApplet{
private PeasyCam cam;
@Override
public void setup() {
background(255);
cam = new PeasyCam(this, 400);
}
public void settings(){
size(200, 200, P3D);
}
public void draw(){
background(255);
rotateX(-.5f);
rotateY(-.5f);
lights();
scale(5);
strokeWeight(1 / 10f);
fill(96, 255, 0);
box(30);
pushMatrix();
translate(0, 0, 20);
fill(0, 96, 255);
box(5);
popMatrix();
}
public void run(){
String[] args = {"com.effibot.provafx.ProcessingTest"};
PApplet.runSketch(args,this);
}
}
public class HelloController {
@FXML
private Label welcomeText;
private ProcessingTest pt;
@FXML
protected void onHelloButtonClick() {
welcomeText.setText("Welcome to JavaFX Application!");
pt = new ProcessingTest();
pt.run();
}
}