Re: Jogl and JavaFX
Posted by Sweck on Apr 03, 2020; 5:12pm
URL: https://forum.jogamp.org/Jogl-and-JavaFX-tp4040468p4040506.html
Okay I got it!
The Objects I wanted to render were not initialized in the swing thread. All OpenGl related stuff is now done in the Swing thread and it works fine.
I thank you all for the help.
I would highly appreciate if anyone still has an idea how to fix this code to work with the newtCanvasFX.
@Override
public void start(Stage primaryStage) throws Exception{
final GLProfile glProfile = GLProfile.getDefault();
final GLCapabilities capabilities = new GLCapabilities(glProfile);
GLWindow glWindow = GLWindow.create(capabilities);
glWindow.addGLEventListener(this);
NewtCanvasJFX canvas= new NewtCanvasJFX(glWindow);
final FPSAnimator animator = new FPSAnimator(glWindow, 60);
animator.start();
StackPane root = new StackPane();
root.getChildren().add(canvas);
primaryStage.setTitle("JavaFX OpenGL");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}