JavaFX 2 + with LWJGL ( OpenGL )

Exo Verse toraktu at gmail.com
Mon Apr 7 15:31:05 UTC 2014


Image 1 -- Shows transparency without button
http://imgur.com/O2fWblv

Image 2 -- No transparency when I add the exit button
http://imgur.com/B4J7NFL


On Mon, Apr 7, 2014 at 11:27 AM, Exo Verse <toraktu at gmail.com> wrote:

> Here is the java and fxml code so you can see what I am doing. This is
> just an example. Also, I am using a 800x600 PNG transparent image.
>
> Main.fxml
> http://pastebin.com/raw.php?i=w7KHTkXy
>
> Main.java
> http://pastebin.com/raw.php?i=he5RGK75
>
> MainController.java
> http://pastebin.com/raw.php?i=VFH4AkLP
>
> The problem is, if you take out the button ( I used scene builder to
> remove the button and the pane its on ) then the transparency works. But as
> soon as I re-add the button in the code / Scene Builder, then the
> transparency is gone. Ideas ?
>
> Torak
>
>
> On Mon, Apr 7, 2014 at 11:19 AM, Exo Verse <toraktu at gmail.com> wrote:
>
>> Will do. :)
>>
>> On another note, I was working on the Launcher Menu for my game, and I
>> was able to successfully make a transparent image form. But as soon as I
>> add a button, the transparency goes away. I need the transparency. I'm not
>> sure what I am missing to bring that back so that any fxml buttons are not
>> overriding it. Ideas ?
>>
>> Torak
>>
>>
>> On Mon, Apr 7, 2014 at 11:12 AM, Richard Bair <richard.bair at oracle.com>wrote:
>>
>>> When you get your game finished, let us know :-).
>>>
>>> On Apr 6, 2014, at 10:09 AM, Exo Verse <toraktu at gmail.com> wrote:
>>>
>>> > Windows makes its own separate stack space for each OpenGL context
>>> > integration. Which is why it runs so smoothly on Windows7. Win7 already
>>> > separates each running process as independent from each other. I can't
>>> > speak for Win8+. I don't like Win8, but that's another topic all of its
>>> > own. You can use OpenGL API with anything. That in itself is not the
>>> > problem. The problem is, Mixing 2D AND 3D into one. That is where GUIs
>>> are
>>> > a problem for OpenGL and DirectX. You have to design your own if you're
>>> > making your own game engine, which I am. The problem I kept running
>>> into is
>>> > the tools needed for GUI design is crazy expensive or not enough info.
>>> I am
>>> > an indie game dev, so I have to use what is available to me. JavaFX is
>>> > brilliant in the way it's GUI design works. I have tried JMonkey, but
>>> even
>>> > their Nifty GUI is not exactly user friendly. Same goes with JOGL.
>>> LWJGL is
>>> > simple to use and it uses the same calls as C++ API call in OpenGL
>>> use. So
>>> > since I am used to the API calls of OpenGL, LWJGL was a no brainer for
>>> me.
>>> >
>>> > So I'll break down your question : "if you get a native OpenGLContext i
>>> > thought you could use any other library to mix in custom OpenGL code
>>> into
>>> > your javafx application"
>>> > The short answer is, you can, but with limited means because 2D and 3D
>>> > can't be mixed without a LOT of overhead, at least, that was what I
>>> kept
>>> > reading all over the net. Well, thanks to your link you provided me
>>> > earlier, I was able to find someone who figured out how to do it with
>>> as
>>> > little overhead as possible. I have his code on my computer now and I
>>> have
>>> > been going over it. I can't believe it is this simple. LWJGL and
>>> JavaFX do
>>> > work well together. I am very impressed.
>>> >
>>> > I have enjoyed our conversations Tom. You have definitely made my day.
>>> :)
>>> >
>>> > Cheers,
>>> > Torak
>>> >
>>> >
>>> > On Sun, Apr 6, 2014 at 12:56 PM, Tom Schindl <
>>> tom.schindl at bestsolution.at>wrote:
>>> >
>>> >> My wording was incorrect better worded: javafx does not  ship an
>>> OpenGL
>>> >> prism pipeline on Windows. And to repeat if you get a native
>>> OpenGLContext
>>> >> i thought you could use any other library to mix in custom OpenGL
>>> code into
>>> >> your javafx application, not?
>>> >>
>>> >> Tom
>>> >>
>>> >> Von meinem iPhone gesendet
>>> >>
>>> >>> Am 06.04.2014 um 18:41 schrieb Exo Verse <toraktu at gmail.com>:
>>> >>>
>>> >>> 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 :
>>> >>> https://github.com/Spasi/LWJGL-FX
>>> >>>
>>> >>> 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 bestsolution.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 gmail.com>:
>>> >>>>>
>>> >>>>> 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 bestsolution.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
>>> >>>>>> https://bitbucket.org/dejayberlin/joglfxpipeline/src!
>>> >>>>>>
>>> >>>>>> Tom
>>> >>>>>> Von meinem iPhone gesendet
>>> >>>>>>
>>> >>>>>>> Am 06.04.2014 um 17:25 schrieb Exo Verse <toraktu at gmail.com>:
>>> >>>>>>>
>>> >>>>>>> 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 gmail.com
>>> >>>>>>> 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 gmail.com>:
>>> >>>>>>>>>
>>> >>>>>>>>> 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 gmail.com
>>> >>>>>
>>> >>>>>>>>> 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 gmail.com>
>>> 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