Jogl and JavaFX

classic Classic list List threaded Threaded
26 messages Options
12
ul
Reply | Threaded
Open this post in threaded view
|

Jogl and JavaFX

ul
I completely lost faith in Sun when they abandoned Java3D. In fact I dropped Java entirely in favour of C++. But Oracle seems different and now I see Java3D is back as the 3D part of JavaFX so I thought it may be time to give Java another chance. But If I use JavaFX (of Java 8) for a GUI and its 3D capabilities don't cut it I need a fallback.

Can I use Jogl with JavaFX?
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

Sven Gothel
Administrator
On 11/30/2013 07:19 AM, ul [via jogamp] wrote:
> I completely lost faith in Sun when they abandoned Java3D. In fact I dropped
> Java entirely in favour of C++. But Oracle seems different and now I see
> Java3D is back as the 3D part of JavaFX so I thought it may be time to give
> Java another chance. But If I use JavaFX (of Java 8) for a GUI and its 3D
> capabilities don't cut it I need a fallback.
>
> Can I use Jogl with JavaFX?

In parallel on the same JVM ofc you can.

Migrating might be a problem.

At least you would be able to use JOGL for offscreen rendering
and later compositing into the javafx scene[1] similar to what we do
with GLJPanel!

If you find a solution (-> [1]) you can copy GLJPanel and change it
appropriately. We can help a little bit and merge it into JOGL.
Shouldn't be too hard.

[1] I don't know JavaFx so you would need to check for yourself.

~Sven


signature.asc (911 bytes) Download Attachment
ul
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

ul
I'm sorry, your reply is too technical for me to understand.

I'm not going to port or migrate anyting. I'm starting anew with JavaFX (Java version 8).

I'm wondering if Jogl can be used in the JavaFX environment (how and with what limitations)
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

gouessej
Administrator
Hi

There is a bug report about that:
https://jogamp.org/bugzilla/show_bug.cgi?id=607

In short, this is currently not supported, there is already an example that could be ported to JOGL but it would be suboptimal in terms of speed / memory footprint and there is not yet any public mean of disabling Direct3D in JavaFX under Windows which could cause driver conflicts. We need some contributors; if you don't feel able to port or migrate anything, there will probably have no JOGL JavaFX interoperability for a while.

JavaFX 3D API seems to have the same design flaws that Sun's implementation of Java3D.
Julien Gouesse | Personal blog | Website
ul
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

ul
This post was updated on .
Thanks, I think I get the picture now.

I looks like I have three major options. First I can use JavaFX and its Java3D-like capabilities without Jogl. Second I can use Swing/AWT/NEWT with Jogl. And third I can use JFace/SWT with Jogl.

JavaFX is the future but once bitten twice shy as they say and that's how I feel about it. I really would want a fallback on OpenGL if the 3D part of JavaFX for some reason is limiting.

The Swing option probably is the best right now but it's not that fun to work with deprecated technology. No new features, no bug fixes, a dwindling user community and all that.

So it may be that the Eclipse option is the best really. Eclipse is well supported with a huge infrastructure and probably the most successful Java application ever on the desktop. SWT may very well be the ultimate portable GUI subsystem I couldn't find in the C++ world.

My question then becomes, how well supported is Jogl on SWT really? I'll ask that in a new thread.

http://forum.jogamp.org/Jogl-and-SWT-td4030775.html

Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

gouessej
Administrator
ul wrote
Thanks, I think I get the picture now.
You're welcome.

ul wrote
I looks like I have three major options. First I can use JavaFX and its Java3D-like capabilities without Jogl.
Expect very bad performance on machines using the (fallback) software renderer and JavaFX 3D APIs are poorer than the ones of major scenegraphs supporting JOGL 2.x.

ul wrote
Second I can use Swing/AWT/NEWT with Jogl.
There is an example of project using JOGL with Netbeans Platform (not very up to date):
https://github.com/nilshoffmann/netbeans-jogl2
This is the most reliable "option".

ul wrote
And third I can use JFace/SWT with Jogl.
Why not?

ul wrote
JavaFX is the future but once bitten twice shy as they say and that's how I feel about it. I really would want a fallback on OpenGL if the 3D part of JavaFX for some reason is limiting.
JavaFX itself has some design flaws. Its memory footprint is noticeably bigger than the one of Swing. It's better with Java 1.8 but deployment with Java 1.7 is not that good, there are some troubles when an old version of JavaFX separated from the JRE is still installed when you update this JRE. JavaFX can be interesting but it is so rigid, it's designed to be used as is, some efforts are done to allow some interoperability with SWT and Swing but I wouldn't rely on that.

ul wrote
The Swing option probably is the best right now but it's not that fun to work with deprecated technology. No new features, no bug fixes, a dwindling user community and all that.
Do you think it is really fun to work with extremely immature technologies? JavaFX doesn't have a large community anyway.

ul wrote
So it may be that the Eclipse option is the best really. Eclipse is well supported with a huge infrastructure and probably the most successful Java application ever on the desktop. SWT may very well be the ultimate portable GUI subsystem I couldn't find in the C++ world.
I wouldn't consider it as portable as Swing.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

jmaasing
In reply to this post by ul
ul wrote
The Swing option probably is the best right now but it's not that fun to work with deprecated technology. No new features, no bug fixes, a dwindling user community and all that.
Calling it dwindling and deprecated is premature I think, we will have Swing around for many years. JavaFX will not be production ready (in my opinion) in Java8, maybe in java9. Swing is battle tested for many, many years. There are no new features mainly because; how many new features do you need to lay out a menu

I would say the big difference right now is that JavaFX focus on eye candy and capturing the minds of the html5/css-crowd. Swing is easy and ugly, meaning that it does not focus so much on the developer being able to change look and feel so much as getting a working GUI up and running.

I have never had any problems finding answers to my Swing questions but I have had problems with SWT (mainly on linux) so my personal preference is to use Swing (and netbeans RCP) for desktop applications.
ul
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

ul
This post was updated on .
In reply to this post by ul
Well, I didn't think Swing would go away overnight really. But since Oracle is presenting JavaFX as "the next step in the evolution of Java" and I'm starting a new fresh project, JavaFX would be my preferred GUI technology. Too bad only that Oracle didn't build in OpenGL support right from the start.

If I recall correctly SWT was introduced because AWT didn't cut it. AWT was in fact quite crappy for a long time and it was first when faced with the SWT competition Sun got their act together and started improving on AWT. This has influenced my thinking but it's ancient history now and I'm starting to believe that Swing/AWT of today may be the better option after all.

Anyway now I've something to think about until Java 8 arrives when I must've made my mind up. Things may have changed by then but since JavaFX doesn't seem to be a viable option I may decide to stick with C++ after all (there I have Qt and G3D which seems like a good combo).

Again thanks for your replies.
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

gouessej
Administrator
You can use QtJambi in Java too.
Julien Gouesse | Personal blog | Website
ul
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

ul
Hi,

My reason for considering Java is that I'm not satisfied with the GUI situation in C++ and that includes Qt. So using QtJambi would only put me back in the situation I wanted to escape and at a substantial higher risk.
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

Qu0ll
The main problem with JavaFX for me is that there are only very rudimentary actual 3D features which, and then again only once JFX8 is released, are not much more than loading meshes, applying a few lights and applying basic transforms.  There are no shaders or access to a 3D API such as OpenGL or Direct3D.

As it stands, even though JavaFX is fully hardware accelerated (when supported), the GPU is used almost entirely for rendering 2D graphics.  However, I do know that Oracle has tried some experiments integrating with both JOGL and LWJGL to provide a kind of "3D Canvas" like WebGL to complement their existing 2D Canvas.

They have not made any official announcements in this area but I am very confident such a feature will be included in JFX9 in 2016 or so.

For this reason I really hope projects such as JOGL and LWJGL continue to thrive as there will probably *never* be support for 3D functionality in JavaFX that comes even close to that currently provided by these libraries.

Having said that though, JavaFX is still an awesome piece of technology, especially for 2D graphics and GUIs.
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

gouessej
Administrator
Hi

Qu0ll wrote
As it stands, even though JavaFX is fully hardware accelerated (when supported), the GPU is used almost entirely for rendering 2D graphics.  However, I do know that Oracle has tried some experiments integrating with both JOGL and ***** to provide a kind of "3D Canvas" like WebGL to complement their existing 2D Canvas.
Do you have a reference about that? Maybe an Oracle employee talked about that at Java One, didn't he?

I'm not really motivated to implement any kind of interoperability with JavaFX but I will reconsider my position if and only if Oracle provides public APIs to do that and if Sven agrees with me.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

Qu0ll
I don't have a reference and the work at this stage would be nothing more than experimental.

I would not expect any WebGL-like Canvas feature in JavaFX at least until JFX9 and, even then, possibly later.

Further, we are looking at 2016/7 at the earliest and I strongly doubt that such a Canvas would have anything more than a fraction of the true 3D functionality that JOGL already provides today.

In other words, don't hold your breath.  JavaFX is not a toolkit to use if you have serious 3D requirements.  The 3D features coming next year in JFX8 add some nice things to the existing API but are really only "token" in their nature when compared to proper/full 3D libraries.
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

Qu0ll
To follow on from that, I think there is excellent value to be gained by integrating JavaFX and JOGL *NOW* instead of waiting for years and years only to get an inferior product.

I am personally going to be heavily involved with JavaFX in 2014 and may well be wanting to work on such an integration to satisfy my own 3D requirements.

The only other alternative I have is to completely walk away from Java/JavaFX and use something like Qt which would be an absolute last resort!
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

gouessej
Administrator
In reply to this post by Qu0ll
Actually, I was right, Felipe Heidrich talked about that during an event, I'll have to talk to him about that:
https://oracleus.activeevents.com/2013/connect/fileDownload/session/C3B800733D28DB105AB5FC964843D1AB/CON1905_Heidrich.pptx
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

Qu0ll
Oh good, I am so glad you found that.  I thought I had let the cat out of the bag when I remembered that it was an Oracle staff member who told me about it privately.  Good to see it's all in the public domain now!

Anyway, do you see anything there that looks promising?  Again, even though Felipe mentioned it in a talk, I am pretty sure an official JavaFX GLNode is many years away whereas I think we could have a first class JavaFX/JOGL integration solution way before then if we put our minds to it.

And, we could make it run on Windows too...
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

gouessej
Administrator
Personally, I need OpenGL 1 and OpenGL-ES 1 support otherwise it will be quite useless for me. I have to update the bug report about this subject.

It looks promising because he identified the biggest difficulties but there is some work to do. I still think that JavaFX has an higher memory footprint than Swing... When I have some time, I will have to reevaluate the amount of work required to make it work for real. I remind you that his first suggestion of implementation is slow but easily doable because there is already a working example that can be ported to JOGL 2.x. I'm very busy, I have tons of things to do on Ardor3D and then in the NEWT Input API... We need more contributors.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

Qu0ll
Out of curiosity, why do you need OpenGL 1 and OpenGL-ES 1 support?
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

gouessej
Administrator
I don't want to encourage planned obsolescence as usual. My main computer was made in 2004 and it is still working. Moreover, some people still install no OpenGL driver under Microsoft Windows, then they have a crappy Microsoft GDI renderer supporting only OpenGL 1.1 (sometimes OpenGL 1.4). I can't just say "let's drop OpenGL 1".
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl and JavaFX

Qu0ll
Well, OpenGL 1 support or not, I certainly think the community should be investing effort in getting JavaFX and JOGL to work together.  I am sure that the JOGL community could have a workable solution up and running *years* before anything Oracle releases.  And, it would be vastly superior anyway...

Any takers?  Just think of the possibilities of utilising the awesome features of JavaFX that are lacking in JOGL such as rich media support, WebKit, charts, 2D animations, vector graphics and not to mention a vast set of UI controls!

The end result (especially when combined with all the work going on to port Java and JavaFX to iOS and Android) would a killer product - no doubt.
12