husker-dev / openglfx

OpenGL node for JavaFX
Apache License 2.0
88 stars 12 forks source link

Example code generator is no longer available #83

Open carlislefox opened 1 month ago

carlislefox commented 1 month ago

This library looks like exactly what I have been looking for, but it is impenetrable without any code examples.

I've just spent a few hours getting my JavaFX project set up and working with the LibGDX backend (learning about module exports, isn't java fun) only to hit an issue where it appears there are no Application instances in the LibGDXExecutor.

I am sure there is a good reason for this, and something I should be doing, but the example code generator link is dead so with no examples or documentation I'm at somewhat of a loss...

husker-dev commented 1 month ago

Forgot to pay for the domain :) Now it should work.


LibGDXExecutor is a "bridge" object between LibGDX and openglfx. It doesn't contain Application. You should think of openglfx as a node, not an window or application.

LibGDX also has a separate usage in openglfx:

// 1. Create JavaFX window as always
// ...

// 2. Create LibGDXCanvas with the game instance (ApplicationAdapter)
GLCanvas canvas = new LibGDXCanvas(new MyGdxGame())

// 3. Then add canvas to the JavaFX Scene
stage.setScene(new Scene(canvas));

Full example can be found here: https://github.com/husker-dev/openglfx/tree/9fb8c268f3397af8d46e591529da63c69984c839/modules/libgdx/src/examples/kotlin/com/huskerdev/openglfx/libgdx/test/game


Also note - don't use openglfx+JavaFX in your game for UI - it has some performance overhead. The best option is to use it as an editor or some debugging tool.