JavaFX 2 + with LWJGL ( OpenGL )

Matthias Hänel haenel at
Tue Apr 8 09:20:55 UTC 2014

Hey guys,

I followed the discussion with interest. I just checked the lwjdlfx-approach. It looked promising in the first place but it has still major performance issues. It is based on the snapshot functionality
in the Node base class. This is actually a similar approach we've seen in the JFXPanel
which indeed has horrible performance. From my point of view it is not the way to go.

What I really like to see is a way to get a textureID directly into the JavaFX 
opengl context wraped with an Image object. I know it's pretty hard to do this cross-platform
and cross-implementation (DirectX, OpenGl) but otherwise JFX can't be mixed with Third-Party 

Okay, using JFX on top of a OpenGL game just as a replacement of the UI-framework like Ogre-UI 
etc. might still be a good point since there is no high performance need. 

In our case we need both high performance UI and high performance additional OpenGL drawings.
As of today I could only use JavaFX with a SwingPanel that encapsulates a JOGL context... 

just my 2 cents

Am 07.04.2014 um 18:47 schrieb Stephen F Northover <steve.x.northover at>:

> The lwjglfx solution.
> Steve
> On 2014-04-07 12:45 PM, Exo Verse wrote:
>> @ Steve
>> Which approach are you referring too ? The lwjglfx solution or this
>> transparency background solution ?
>> The lwjglfx I am assuming here since its drawing out to an image and back
>> in again. But if your speaking about my transparency issue I solved, I
>> didn't realize it was sending out to an image and back again. Could you
>> please elaborate as to which solution your speaking about ?
>> Torak
>> On Mon, Apr 7, 2014 at 12:33 PM, Stephen F Northover <
>> steve.x.northover at> wrote:
>>> This solution is cool, but it draws to an image, sucks out the bits and
>>> then converts that to an FX image.  This is a good approach because it uses
>>> API and does not rely on any internals of FX. Hopefully it is fast enough
>>> for you.
>>> Steve
>>> On 2014-04-06 12:41 PM, Exo Verse wrote:
>>>> Yea the OpenGL comes with your graphics drivers for your video card. So
>>>> your correct that it doesn't ship with JavaFX. What I have been going on
>>>> about is trying to find a way to use JavaFX with LWJGL. In case you are
>>>> unaware, LWJGL just means "Light Weight Java OpenGL" and its a wrapper for
>>>> the OpenGL API. It's an alternative to JOGL.
>>>> On another note, as I did a search, Thanks to Tom showing me that link I
>>>> examined that code and I found something of interest in the JOGL code
>>>> interface..  well it lead me to a google search, and viola..  LWJGL with
>>>> JavaFX. :)
>>>> LINK :
>>>> So just wanted to post the link here and say thanks for all of your help.
>>>> :)
>>>> Cheers,
>>>> Torak
>>>> On Sun, Apr 6, 2014 at 12:35 PM, Tom Schindl <tom.schindl at
>>>>> wrote:
>>>>  JavaFX does not ship OpenGL binaries on windows you have to build it your
>>>>> own.
>>>>> Please note:
>>>>> a) if there are people who manage to write a prism pipeline on jogl why
>>>>> should you not be able to do the same with lwjgl?
>>>>> b) the talk i mentionned from felipe and steve show how to get access to
>>>>> the native OpenGL context and there from you can use any API you like
>>>>> can't
>>>>> remember which one they used
>>>>> Tom
>>>>> Von meinem iPhone gesendet
>>>>>  Am 06.04.2014 um 18:18 schrieb Exo Verse <toraktu at>:
>>>>>> Thanks, but as I mentioned in my original post, I don't like JOGL. It
>>>>>> doesn't work with my setup. I use LWJGL because its only about the
>>>>>> OpenGL
>>>>>> and not other libraries, and its an easy API wrapper to use. There are
>>>>> many
>>>>>> many reason I hate JOGL.. but this thread is not about hating on JOGL,
>>>>> its
>>>>>> about finding a way to use LWJGL with JavaFX2+.
>>>>>> Also, Win32 API calls can use both DirectX and OpenGL APIs. And it
>>>>> doesn't
>>>>>> matter what Windows OS you're using. I have tested this out from Windows
>>>>> XP
>>>>>> all the way to Windows 7 - 32/64 Bit with no problem.
>>>>>> Cheers
>>>>>> Torak
>>>>>> On Sun, Apr 6, 2014 at 11:52 AM, Tom Schindl <
>>>>> tom.schindl at>wrote:
>>>>>> There is a talk from Felipe and Steve at J1 last year how to embed
>>>>>> OpenGL
>>>>>> into FX using *internal* API!
>>>>>>> Search for it on parleys - this does not help you on Win32 which uses
>>>>>>> directx instead of javafx. BTW there are people doing a JOGL pipeline
>>>>>>> Tom
>>>>>>> Von meinem iPhone gesendet
>>>>>>>  Am 06.04.2014 um 17:25 schrieb Exo Verse <toraktu at>:
>>>>>>>> Yea its a shame that using JavaFX as an option along with OpenGL
>>>>>>>> wasn't
>>>>>>>> even thought of to begin with. I don't understand why they limit you
>>>>>>> like
>>>>>> they do. Them trying to recreate the wheel and make their own version
>>>>>>> of
>>>>>> a
>>>>>>>> 3D interface is just plain stupid if it can't run low level. I can see
>>>>>>> 2D
>>>>>> games and applications with a LOT of usage for JavaFX and its 2D
>>>>>>> graphics
>>>>>> API. But True 3D needs low level other wise its a waste of time.
>>>>>>>> Well, thanks for the replies. Guess I'll have to stick with using
>>>>>>>> other
>>>>>>>> sources for my GUI. It's just that I like JavaFX version of its GUI
>>>>>>> because
>>>>>>>> it is so simple to use. But not worth it if you can't use it for the
>>>>>>> reason
>>>>>>>> that we the people need it for. Like in my case, game dev.
>>>>>>>> Cheers.
>>>>>>>> Torak
>>>>>>>> On Sun, Apr 6, 2014 at 10:48 AM, Philipp Dörfler <
>>>>>>>> phdoerfler at
>>>>>>>> wrote:
>>>>>>>>  It is not possible to combine JavaFX and OpenGL as it is right now.
>>>>>>>> This
>>>>>> was discussed on this mailing list some time before as a _possible_
>>>>>>>> future
>>>>>>>> addition, but I'd be very surprised if Oracle actually chose to
>>>>>>>> implement
>>>>>>>> this.
>>>>>>>>> Starting with JavaFX 8 there is indeed some kind of "3D support" but
>>>>>>>> the
>>>>>> 3D API allows only for the most basic operations. It is still
>>>>>>>> completely
>>>>>> scene graph based and you have to live with all restrictions that
>>>>>>>> JavaFX
>>>>>> imposes on you. Not wanting to say that the 3D API is completely
>>>>>>>> useless,
>>>>>>>> but I'm afraid that even WPF is more flexible when it comes to 3D than
>>>>>>>>> JavaFX is. For example: As far as I know you can not even change the
>>>>>>>>> shading model from GL_SMOOTH to GL_FLAT. You could work around that
>>>>>>>>> by
>>>>>>>>> setting the normals yourself though (Same for WPF). Also render
>>>>>>>> quality
>>>>>> is
>>>>>>>> bad when you render an instance of Text in 3D and scale it down for
>>>>>>>>> example. At least it was when I tried that last time (few months
>>>>>>>>> ago).
>>>>>>>>> Again, not to say that one can't work with JavaFX's 3D API, but it's
>>>>>>>> not
>>>>>> raw OpenGL either. As far as I know the JavaFX team wants to be able
>>>>>>>> to
>>>>>> let
>>>>>>>> the user use his own OpenGL context and let JavaFX render on top of
>>>>>>>> that or
>>>>>>>> add the possibility to ask JavaFX for the underlying context and mess
>>>>>>>> with
>>>>>>>> that but this is not even officially planned or included on any
>>>>>>>> roadmap
>>>>>> (AFAIK) so we can only keep our fingers crossed for that to happen.
>>>>>>>> Like
>>>>>> you I would absolutely LOVE to use JavaFX as a GUI on top of my OpenGL
>>>>>>>>> games.
>>>>>>>>> Cheers
>>>>>>>>> Philipp Dörfler
>>>>>>>>>  Am 06.04.2014 um 16:31 schrieb Exo Verse <toraktu at>:
>>>>>>>>>> Can you please explain what True 3D means in terms of Low Level API
>>>>>>>>>> ?
>>>>>>>>>> Because with LWJGL I can use Low Level API to talk directly to my
>>>>>>>>> Video
>>>>>> Card. As a game dev, I need every ounce of umph from the card I can
>>>>>>>>> get,
>>>>>>>> and using a browser or any other kind of wrapper hasn't proven very
>>>>>>>>>> efficient. I love LWJGL because of its simplicity. Anything extra I
>>>>>>>>> need, I
>>>>>>>>>> am allowed to make on my own. Example, my own Game Engine.
>>>>>>>>>> And that is where I am at. So if your speaking about Nodes, I am
>>>>>>>>> aware
>>>>>> there is a hierarchy to the JavaFX2 when setting up the GUI, but that
>>>>>>>>> is
>>>>>>>> the only thing I knew existed. Could you please elaborate what makes
>>>>>>>>>> JavaFX8 a True 3D Low Level interface API ? Because from the
>>>>>>>>> presentation,
>>>>>>>>>> you have to go through two layers before you have to get to the
>>>>>>>>> OpenGL
>>>>>> layer. Where as if I can use LWJGL, I can skip a level.
>>>>>>>>>> If I am misinformed on something, please, explain. Because I am new
>>>>>>>>> to
>>>>>> JavaFX.
>>>>>>>>>> Cheers,
>>>>>>>>>> Torak
>>>>>>>>>>  On Sun, Apr 6, 2014 at 10:24 AM, Hervé Girod <
>>>>>>>>>>> herve.girod at
>>>>>>>>>> wrote:
>>>>>>>>>>  With Java 8 (JavaFX 8), you now have true 3D Nodes, with camera,
>>>>>>>>>>> texturing, etc... However it would still be very interesting to be
>>>>>>>>>> able
>>>>>>>> to
>>>>>>>>>> control the low-level rendering of JavaFX, such as using LWJGL for
>>>>>>>>>> example.
>>>>>>>>>> This would allow to render JavaFx content in an external OpenGL
>>>>>>>>>> context
>>>>>>>> for
>>>>>>>>>> example.
>>>>>>>>>>> Hervé
>>>>>>>>>>> Sent from my iPad
>>>>>>>>>>>  On 6 avr. 2014, at 14:42, Exo Verse <toraktu at> wrote:
>>>>>>>>>>>> Hello, I have been working with OpenGL and LWJGL for over 5 years
>>>>>>>>>>> now.
>>>>>>>> I
>>>>>>>>>> want to switch over to using JavaFX 2, because of its GUI abilities
>>>>>>>>>>> and
>>>>>>>> still use LWJGL with it. But I can't seem to find a way to do
>>>>>>>>>>> this. I
>>>>>> saw a
>>>>>>>>>>>> 2 hour video that described the features of JavaFX 2 and it even
>>>>>>>>>>> shown
>>>>>>>> the
>>>>>>>>>>>> layout..  OpenGL was there at the bottom with D3D with Prism above
>>>>>>>>>>> both
>>>>>>>> of
>>>>>>>>>>>> them in the hierarchy. I have searched the web and I can't find
>>>>>>>>>>> prism,
>>>>>>>> I
>>>>>>>>>> can't find info on how to talk to opengl and I can't find any
>>>>>>>>>>> tutorials
>>>>>>>> anywhere. So I am posting here to see what I can find. I do NOT
>>>>>>>>>>> like
>>>>>> JOGL.
>>>>>>>>>>>> I prefer LWJGL. So far, the only thing related to 3D with regards
>>>>>>>>>>> to
>>>>>> JavaFX
>>>>>>>>>>>> is the very resource intensive Canvas3D, which I can't stand. Any
>>>>>>>>>>> ideas ?
>>>>>>>>>> Is it not implemented yet and its on its way ? I'm trying to find
>>>>>>>>>>> any
>>>>>> info
>>>>>>>>>>>> I can about this. If there is nothing for LWJGL, then I can't use
>>>>>>>>>>> JavaFX.
>>>>>>>>>> Thanks.
>>>>>>>>>>>> Torak

More information about the openjfx-dev mailing list