Jogl speed with libGdx when under JavaFX SwingNode

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Jogl speed with libGdx when under JavaFX SwingNode

Pasi Lasse
Hi!

I'm using libGdx and jogl as backend. When using JoglSwingCanvas in a Swing frame I get really good performance and everything seems to work fine.

When I create a JavaFX scene with a swing node and add JoglSwingCanvas there it still works fine but performance really drops. Seems to be related to canvas size. Is there some behind-the-scenes frame copy to CPU memory that happens? I can still see high GPU usage so it's definitely not fully drawing with CPU. I have tried both vsync disabled and enabled.

Any ideas what could cause the slowdown and how to avoid it? Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Jogl speed with libGdx when under JavaFX SwingNode

gouessej
Administrator
Hello

Somebody should use NewtCanvasJFX within the LibGDX backend, it would drastically improve the performance, this is what I plan to do in JogAmp's Ardor3D Continuation. Which version of LibGDX do you use? Where have you found the JOGL backend?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl speed with libGdx when under JavaFX SwingNode

Pasi Lasse
Hi,

and thank you for your answer. I got the backend from
https://mvnrepository.com/artifact/org.jogamp.libgdx/gdx-backend-jogamp/1.9.4
And libGdx is version 1.9.6

How big of a task do you think it would be to start using the NewtCanvasJfx myself?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Jogl speed with libGdx when under JavaFX SwingNode

gouessej
Administrator
Actually, you use "my" stuff lol. As I'm preparing myself to leave Github, I deleted most of my projects on this website. You can use the source code of this contributor:
https://github.com/bgroenks96/libgdx/tree/master/backends/gdx-backend-jogamp
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl speed with libGdx when under JavaFX SwingNode

Pasi Lasse
Thanks. Even that project seems to have been inactive for years. But you think the NewtFxCanvas, should I be able to use that in place of the JoglSwingCanvas, would be faster? And that would probably work as a JavaFX node instead of a swing component under a SwingNode?

If I get this to work I'll put the source code available somewhere. It seems based on forums that quite a few would like working openGL under JavaFX...
Reply | Threaded
Open this post in threaded view
|

Re: Jogl speed with libGdx when under JavaFX SwingNode

gouessej
Administrator
You're welcome. Maintaining several frameworks and engines is time consuming. I think that most of the biggest efforts have already been done. Using other canvases as examples could help you but honestly, JogAmp's Ardor3D Continuation has a "better" design which helps me to add some support for a new GUI framework very quickly (which is what I'll do for OpenJFX/JavaFX when the next JOGL version is released and available on Maven Central).

I'm sure that it would be faster, that's the main interest of avoiding to use a SwingNode. I advise you to give a try to NewtCanvasJFX with plain JOGL and you'll see the difference.

Some changes in OpenJFX/JavaFX planned for its version 13 will help to interoperate with OpenGL:
https://jogamp.org/bugzilla/show_bug.cgi?id=607#c26
Julien Gouesse | Personal blog | Website