I don’t have a lot of time to work on it. Some help would be welcome. Decompiling JavaFX is not difficult with JD-GUI (I will give some money to the creator of this nice tool).
Keep in mind that Oracle gave up JOGL and now it uses only native OpenGL calls, no real binding. I’m not very motivated to make an effort on something that might be quickly broken if Oracle modifies its APIs.
thank you for your tips in edit 3, I’ll check it out. I’m a bit embarrassed but I got a little lost with the NEWT
classes for window handling. They are also in different packages. I’m always so damn impatient =)
Hopefully they’ll make prism open source soon. I totally understand your hesitation about the evolving JavaFX code
structure. I can also totally understand the JavaFX team desire to encapsulate the rendering pipeline to avoid breaking
applications for updates. I still think it’s very important to be able to do stuff like this.
[quote]Edit.9: Dejay’s suggestion is not trivial to implement with the latest version of JavaFX 2.2 because it is impossible to instantiate NGNode.
[/quote]
I used NGRegion which has a public constructor and doesn’t do much, but I’m hoping when they remove the impl methods they will
provide a better mechanism like a factory pattern where you can register rendering controllers for new nodes.
Probably NGCanvas has a lot of stuff in it already for the deferring of the canvas draw calls.
What I’ve tried is implementing a “JOGLPipeline” that only seems to need 7 classes that make up the render pipeline. Basically
an abstraction of shaders, vertex buffers and some predefined shaders to render shapes with compositing etc. The design of
the prism renderer is pretty nice IMO.
I’ve pasted my pathetic code for your entertainment: https://gist.github.com/3564076
public class JOGLPipeline extends GraphicsPipeline
public class JOGLResourceFactory extends BaseShaderFactory
public class JOGLPresentable implements Presentable, GraphicsResource
public class JOGLContext extends BaseShaderContext
public class JOGLShader implements Shader
public class JOGLVertexBuffer extends VertexBuffer
public class JOGLGraphics extends BaseShaderGraphics
And a class “com.sun.prism.jogl.JOGLPipeline extends org.dejay.prism.opengl.JOGLPipeline”.
This can be injected into PrismSettings (it’s instantiated with string concatenation and getClassForName)
PrismSettings.verbose = true;
PrismSettings.tryOrder = new String[] { “jogl” };
Application.launch(args);
I’ve only implemented some log traces and rendered an empty scene to find out what’s happening.
I’m not sure how to attach a jogl GLWindow to the view created by JavaFX glass. Atm I tried:
window = NewtFactory.createWindow(view.getNativeView(), screen, new GLCapabilities(GLProfile.getDefault()));
glWindow = GLWindow.create(window);
Good job Your source code is a nice way of beginning the implementation of JavaFX/JOGL interoperability but we still need to get a clear answer to these questions:
how to disable the Direct3D pipeline under Windows?
Oracle, are you gonna break our stuff with your changes?
I’m not a big fan of Microsoft but if we can’t support Windows, all this is quite a waste of time.
I haven’t gotten any response of the devs to my post on the oracle forum yet.
[quote]- how to disable the Direct3D pipeline under Windows?
[/quote]
Theoretically with “-Dprism.order=es2” which sets “PrismSettings.tryOrder = new String[] { “es2” };”
Here is a very sad bug for you ;( http://javafx-jira.kenai.com/browse/RT-17404
Apparently it was done to reduce memory footprint / startup time which makes sense,
since they only use a handful of methods to handle vertex buffers, textures, framebuffers etc.
But as long as you can bind JOGL to an existing gl context, it doesn’t matter I think. The internal
casting of Graphics to ES2Graphics is nice but the internal jogl wouldn’t be updated very often
anyway. IF and WHEN they release a gl es2 pipeline under windows.
I don’t know if you can use a OpenGL 3/4 context with a GLES context though.
Is it possible and realistic to do offscreen rendering with JOGL / LWJGL, then switch the result image to JavaFX ?
What approach would be better ?
(I don’t need state of the art graphics, I’m using the fixed pipeline. Rendering should be as fast as possible though)
I’ve seen terms such as pbuffers and FBOs… ??
I’ve just posted something about the most recent piece of information I obtained from Oracle about the use of native APIs (especially OpenGL) with JavaFX: https://jogamp.org/bugzilla/show_bug.cgi?id=607#c13
I’ll start working on JavaFX when I have some time and when OpenJFX is bundled with OpenJDK (probably before March 2014). Keep in mind that I’m very busy (Ardor3D, NEWT Input API, …).
I think that Felipe answered to a lot of our questions about JogAmp OpenJFX / JavaFX interoperability in the document that I quoted in the bug report above.
Sorry to be unclear about the road map and contributions are welcome.
I’ve just posted something about the most recent piece of information I obtained from Oracle about the use of native APIs (especially OpenGL) with JavaFX: https://jogamp.org/bugzilla/show_bug.cgi?id=607#c13
I’ll start working on JavaFX when I have some time and when OpenJFX is bundled with OpenJDK (probably before March 2014). Keep in mind that I’m very busy (Ardor3D, NEWT Input API, …).
I think that Felipe answered to a lot of our questions about JogAmp OpenJFX / JavaFX interoperability in the document that I quoted in the bug report above.
Sorry to be unclear about the road map and contributions are welcome.
Hi Julien, thanks for all your work on JOGL etc together with Sven and others.
Your idea to bring JOGL and JavaFX together would much be appreciated. Because, like you, I don’t want to throw away our good old computers just because they’re older but still work perfectly.
And JavaFX can be useful for new projects (not neccesarily as replacement for Swing), but its demand for newer GPUs is very hard, whilst JOGL runs nearly everyhwere.
Hi Julien, thanks for all your work on JOGL etc together with Sven and others.
Your idea to bring JOGL and JavaFX together would much be appreciated. Because, like you, I don’t want to throw away our good old computers just because they’re older but still work perfectly.
And JavaFX can be useful for new projects (not neccesarily as replacement for Swing), but its demand for newer GPUs is very hard, whilst JOGL runs nearly everyhwere.
You’re welcome. Sorry for the late reply, I was at the FOSDEM. I will implement GLJFXPanel (OpenJFX/JavaFX panel with JOGL support) for sure, this is the least I can do but I’m not sure that I will succeed in implementing a whole alternative pipeline for JavaFX which means that the native existing ES2 pipeline will have to be used (and shipped by yourself for Windows). If you target low end machines, just forget JavaFX. There is a need of a Java GUI widget toolkit working both in desktop and mobile environments but JOGL Graph UI has a very few components compared to Swing and it doesn’t support OpenGL(-ES) 1. I’ll need to find a real solution on the long term (which JavaFX isn’t despite its rich APIs).
You’re welcome. Sorry for the late reply, I was at the FOSDEM. I will implement GLJFXPanel (OpenJFX/JavaFX panel with JOGL support) for sure, this is the least I can do but I’m not sure that I will succeed in implementing a whole alternative pipeline for JavaFX which means that the native existing ES2 pipeline will have to be used (and shipped by yourself for Windows). If you target low end machines, just forget JavaFX. There is a need of a Java GUI widget toolkit working both in desktop and mobile environments but JOGL Graph UI has a very few components compared to Swing and it doesn’t support OpenGL(-ES) 1. I’ll need to find a real solution on the long term (which JavaFX isn’t despite its rich APIs).
Currently, there are lots of Android smartphones supporting OpenGL-ES 2 but their drivers often offer a better support of OpenGL-ES 1. The software renderer of OpenJFX / JavaFX is really slow. Even simple OpenJFX / JavaFX GUIs have an higher memory footprint than their Swing equivalents. As I explained in the bug report, Oracle already knows that some public APIs are missing to implement a viable interoperability without relying on private APIs that could be removed, there is no need to provide a semi-broken solution in JOGL. We are open to contributions, don’t worry and we listen to our community. Wouldn’t a GLJFXPanel be enough for your needs? If we provide enough instructions to help the developers to ship the native ES2 pipeline for Windows and enable it, there won’t be any problem of conflict at driver level with Direct3D. As I already said, you can still use GLJPanel + SwingNode + JFXPanel in the meantime. I have never denied that in my humble opinion JavaFX has some interesting features, a nice charting API, …
Maybe Preston agrees with me. My concern is that I don’t see JavaFX as a Swing replacement but I really want to provide some sort of interoperability between JOGL and OpenJFX / JavaFX. On my view, this feature is a “must have”. However, I don’t see a fully JOGL based pipeline for OpenJFX / JavaFX as an absolute necessity. What’s wrong with that? You can already tinker the software renderer based on Swing in order to use GLG2D when creating Graphics2D instances, it’s probably slower and less straightforward than a fully JOGL based pipeline but it’s better than nothing, isn’t it?
Sorry to contradict you but I don’t only implement features that I absolutely need or find viable otherwise I would have never contributed to Java3D, Xith3D, JMonkeyEngine, … but I won’t implement a feature that will get completely broken because of changes in private APIs. Please tell me clearly what you mean and what you expect. Right now I have a full time job and I’m responsible of engine support for the JogAmp Foundation on my spare time as a volunteer. There are only 24 hours a day :clue:
I haven’t done anything with JavaFX nor do I know anything about it really.
But I do know that there are some plans to get JavaFX to Android (how realistic the plans are, do not know) and I know that some ppl have it working on their phone, more or less.
My point wasn’t that ppl should use it now or whatever. It was rather “here, take a look, if You are interested”
Currently, there are lots of Android smartphones supporting OpenGL-ES 2 but their drivers often offer a better support of OpenGL-ES 1. The software renderer of OpenJFX / JavaFX is really slow. Even simple OpenJFX / JavaFX GUIs have an higher memory footprint than their Swing equivalents. As I explained in the bug report, Oracle already knows that some public APIs are missing to implement a viable interoperability without relying on private APIs that could be removed, there is no need to provide a semi-broken solution in JOGL. We are open to contributions, don’t worry and we listen to our community. Wouldn’t a GLJFXPanel be enough for your needs? If we provide enough instructions to help the developers to ship the native ES2 pipeline for Windows and enable it, there won’t be any problem of conflict at driver level with Direct3D. As I already said, you can still use GLJPanel + SwingNode + JFXPanel in the meantime. I have never denied that in my humble opinion JavaFX has some interesting features, a nice charting API, …
Maybe Preston agrees with me. My concern is that I don’t see JavaFX as a Swing replacement but I really want to provide some sort of interoperability between JOGL and OpenJFX / JavaFX. On my view, this feature is a “must have”. However, I don’t see a fully JOGL based pipeline for OpenJFX / JavaFX as an absolute necessity. What’s wrong with that? You can already tinker the software renderer based on Swing in order to use GLG2D when creating Graphics2D instances, it’s probably slower and less straightforward than a fully JOGL based pipeline but it’s better than nothing, isn’t it?
Sorry to contradict you but I don’t only implement features that I absolutely need or find viable otherwise I would have never contributed to Java3D, Xith3D, JMonkeyEngine, … but I won’t implement a feature that will get completely broken because of changes in private APIs. Please tell me clearly what you mean and what you expect. Right now I have a full time job and I’m responsible of engine support for the JogAmp Foundation on my spare time as a volunteer. There are only 24 hours a day :clue:
I haven’t done anything with JavaFX nor do I know anything about it really.
But I do know that there are some plans to get JavaFX to Android (how realistic the plans are, do not know) and I know that some ppl have it working on their phone, more or less.
My point wasn’t that ppl should use it now or whatever. It was rather “here, take a look, if You are interested”