This discussion is archived
7 Replies Latest reply: Sep 4, 2012 10:18 AM by jsmith RSS

OpenGL ES2 pipeline for Windows

935214 Newbie
Currently Being Moderated
Hello,

what are the plans to make the prism OpenGL render pipeline open source? Any info / timeframe would be great =)
EDIT: Would it be possible to release an optional jar/dll for an OpenGL ES2 pipeline for windows?

My main concern is to extend JavaFX with custom nodes that allow "bleeding edge" effects like for example custom shaders,
particles, screen space ambient occlusion, realistic water rendering, many thousand of grass leaves you can interact with etc.
Our specialization is actually not games, but multitouch presentations with nice special effects on big screens.

We are currently evaluating JavaFX as a rendering solution. It's compositing functions are great. Basically it would be ideal for
our purposes (except some fps issues with 60fps animations). Our current render engine is C++ / Objective-C based (OS X)
and allows stuff like playing up to 8 full HD movies and integrates OS specific stuff like quarz composer, video capturing etc.
I know about the new canvas node, but it doesn't help us, unfortunately.

What we really need is an "OpenGLNode" that allows low level gl access, e.g. execute OpenGL commands in the prism rendering thread,
using shaders, framebuffers, vertexbuffers etc.
If there where an optional OpenGL (ES) based prism pipeline for windows too, you could switch to OpenGL instead of DirectX at startup
and could develop "special effect" nodes cross platform! Some special care needs to be taken to restore render states, program
and texture bindings of course, but this burden could be placed on the developer. Allowing to use low level access could be an
"unsupported" feature, but atm I think JavaFX 2 is too limited in this way. Allowing it would IMO widen the appeal and usability of
JavaFX not only for games, but also applications like Video Capturing, VJ software, scientific visualization, medical imaging etc.
IMO this would give Java and JavaFX a great boost, alone game development is a big factor.

Previous to 2.2 there was a JOGL based ES2Pipeline for OS X that basically allowed this if you overload "impl_getPGNode()".
Will there be a cleaner way to register a rendering controller (NGNode) in the future? Something like a factory pattern?

So, is prism going to be open source at all and when? =)
One solution I thought about is to write a JOGL based implementation of a prism pipeline myself, put it in "com.sun.prism.jogl.JOGLPipeline"
and activate it with PrismSettings.tryOrder = new String[] { "jogl" };
It doesn't seem to be too much code actually.
But would an open source GLPrismPipeline project with a gpl/ce licence be legal?


Thank you for your time,
Dennis

PS: Another idea might be to have a "SharedSurfaceNode" that uses IO Surface for OSX and Shared Surface on Windows for inter
process integration. The new WritableImage is great, but far to slow because of per pixel conversion and down / upload to video memory.

Edited by: Dejay on Sep 2, 2012 9:20 PM
  • 1. Re: Open source prism renderer using OpenGL
    805536 Journeyer
    Currently Being Moderated
    >
    So, is prism going to be open source at all...

    what are the plans to make the prism OpenGL render pipeline open source? Any info / timeframe would be great =)
    >

    Yes. This might be of interest to you: http://fxexperience.com/2012/02/a-short-tour-through-javafx-ui-common/

    Keep in mind that Prism is considered an implementation detail; There is a strong chance of stuff changing in the future, so any part of it you rely on directly should be considered a hack.

    >
    What we really need is an "OpenGLNode" that allows low level gl access, e.g. execute OpenGL commands in the prism rendering thread,
    using shaders, framebuffers, vertexbuffers etc.
    >

    Someone else wanted to embed Java3D into a JavaFX scene. You could try integrating JOGL via the methods mentioned in that thread: https://forums.oracle.com/forums/thread.jspa?threadID=2417734&tstart=16&messageID=10546925

    Or you could make a feature request at Jira, ask for a way to bind a JavaFX node to a native interface, and write your OpenGL code there.
  • 2. Re: Open source prism renderer using OpenGL
    935214 Newbie
    Currently Being Moderated
    Thank you aiddreamer for the link about Java3D, didn't see that thread.

    But unfortunatly Java3D is a retained mode (high level) 3D api, and I need low level OpenGL access to make use of the
    power modern GPU bring. As an example, there are some really nice WebGL demos out there.
    Also it uses WritableImage for CPU to GPU memory transfer (no fullscreen with 60fps). Might be able to hack around by using different
    code paths for Windows/DirectX and other with OpenGL though.

    I'd settle for an "unsupported solution", since it's necessary that the javaFX team can change implementation details. But the
    main problem is lack of a prism pipeline using OpenGL under Windows. I'm currently looking at how much work this would entail.

    The reason I wish for OpenGL access in JavaFX is the same reason why people are excited about WebGL.

    Cheers,
    Dejay
  • 3. Re: Open source prism renderer using OpenGL
    805536 Journeyer
    Currently Being Moderated
    >
    But unfortunatly Java3D is a retained mode (high level) 3D api, and I need low level OpenGL access to make use of the
    power modern GPU bring.
    >

    I didn't say to "use Java3D in *+place+* of OpenGL", I meant "use the same *+techniques+* being used to integrate Java3D to integrate OpenGL"; That is, render your OpenGL via JOGL to some buffer and transfer it to JavaFX by writing to Canvas via the pixel pushing methods. Or ask Jira for a way to draw things to a JavaFX Node in a native context.
  • 4. Re: Open source prism renderer using OpenGL
    935214 Newbie
    Currently Being Moderated
    Yes, thanks again for the link :)
    From what I gathered from the post, the method would be copying the Java3D rendered Framebuffer / Surface, maybe with map/unmap for a little speedup.
    But copying the framebuffer unfortunatly isn't viable. For example, the first beta's of WebGL in WebKit/Firefox where still using software compositing, which means rendering hardware accelerated on the gpu, downloading from video memory to cpu memory, composite in software using the cpu, then upload again to video memory. Even if you only render 1 single triangle you cannot reach acceptable framerates on fullscreen / larger windows. Now you can run WebGL fullscreen with 60fps. WritableImage is a great addition, but it doesn't allow high performance. So, any suggestion having to do with WritableBuffer is basically a solution that is theoretically feasable, but is so bad that it is practically unusable.

    For Java3D there might be a (very hacky) way to use Java3D in Direct3D mode (with a self compiled 64bit dll) and use some kind of WDM interop in a custom PGNode in JavaFX and a DirectX binding for Java (there is a new one). On Mac OS X or Linux it's rather easy to integrate Java3D running on OpenGL.

    Here is a quick example for a custom PGNode that gets executed in the prism render thread: https://gist.github.com/3600486
    Under Mac OS X or Linux you can just use OpenGL commands in the "renderContent" node (there aren't any in the example).
    Of course this is a hack and relies on implementation details that will change. But the needed code for the node itself is rather small.

    Only two things would be needed to open the host of possibilities to JavaFX that WebGL brings to HTML5 ;)
    1. an OpenGL ES2 GraphicsPipeline for Windows that you can enable at startup
    2. a CustomNode that allows executing code in the prism render thread (instead of application thread)

    JOGL could be used to grab the existing OpenGL context, save all render states and texture/framebuffer/shader bindings and restore them
    after custom rendering. That would be an advanced usecase for JavaFX, but I think many applications would profit greatly from this.
    Check out http://www.chromeexperiments.com/webgl/ for examples.

    Cheers,
    Dejay
  • 5. Re: Open source prism renderer using OpenGL
    805536 Journeyer
    Currently Being Moderated
    Looks like someone did request a way to integrate JOGL into JavaFX, but it isn't currently feasible: https://jogamp.org/bugzilla/show_bug.cgi?id=607

    You can still use JOGL and JavaFX with Swing if you really need to. Otherwise, I would just stick with something other than JavaFX for now if you need low level access.
  • 6. Re: Open source prism renderer using OpenGL
    935214 Newbie
    Currently Being Moderated
    At least the implementation exists internally: http://javafx-jira.kenai.com/browse/RT-11208
    But it isn't released, and prism isn't open source (yet).

    I'm hoping for any information on this topic from the JavaFX developers. Any info would be greatly
    appreciated =)
  • 7. Re: Open source prism renderer using OpenGL
    jsmith Guru
    Currently Being Moderated
    I'm hoping for any information on this topic from the JavaFX developers.
    If you don't get an answer here, post your question to:
    http://mail.openjdk.java.net/mailman/listinfo/openjfx-dev

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points