3rd party GUI w/ jME

I did a search through the forum, but didn't find any relevant topics, so I apologize in advance if this has already been beaten to death.



How easy is it (or is it possible) to use a 3rd party GUI tool with jME (such as FengGUI)?  Does anybody have any experience with this?

I guess the question becomes, does jME expose enough of the underlying renderer to allow a GUI tool to hook in without wreaking

too much havoc on the engine?

Why use FengGUI instead of Swing?

Why use Swing instead of FengGUI?



I think it's not hard to image the benefits of an OpenGL accelarated GUI… and it should be doable to integrate it into jME as well.

I wrote our own here using FengGUI, Swing and BUI as inspiration.  I did so because it does exactly what I want, works well on all platforms (which swing still doesn't) not to mention licensing concerns.  The resulting GUI looks much more game oriented than swing as well, IMHO.

I'm not really a Swing fan, and I like the idea of an OpenGL accelerated GUI like llama says.

Thank you for answering my question.

I'm still a major newbie to jME, as I'm trying to decide if it's the engine I want to use.  Does

jME make it easy to get at the underlying OpenGL easily?  I suppose one would have to be

concerned with the context and such.

On a side note, are there any plans to create an official jME GUI toolkit (perhaps based on FengGUI)?

JMEDesktop (Swing inside jME) is more or less the official jME GUI (it's included with jME). Another available GUI lib is BUI, which is used in Bang Howdy! I believe.



It's very easy to acces LWJGL, and make custom scene elements that use it, so integration should be possible. You'll have to unify the input systems a bit, most likely.

renanse said:

I wrote our own here using FengGUI, Swing and BUI as inspiration.  I did so because it does exactly what I want, works well on all platforms (which swing still doesn't) not to mention licensing concerns.  The resulting GUI looks much more game oriented than swing as well, IMHO.


When is that getting contributed to the JME CVS repository?  :D

Endolf
llama said:

Why use Swing instead of FengGUI?

I think it's not hard to image the benefits of an OpenGL accelarated GUI.. and it should be doable to integrate it into jME as well.


Well, to be honest I'm not a huge fan of Swing myself except it does provide a lot of capabilities for look and feel and has been tested much more thoroughly than any other GUI framework that I know of.  Besides, if we could make use of 1.5's ability to do OpenGL acceleration with Swing in jME we should be able to increase performance significantly, right?

Perhaps I should look at FengGUI again.  I've considered the idea of trying to design a completely 3D GUI framework for LWJGL that is very similar to Swing, but at the moment there are too many other things I should be working on.  :P

Renanse, even if you can't contribute it is there any way we could see some watered-down screenshots? ;)
darkfrog said:

Renanse, even if you can't contribute it is there any way we could see some watered-down screenshots? ;)


I'm guessing this is one of those non-contribute chunks, sorry.  I'll see what I can do about a screen shot though!
darkfrog said:


Well, to be honest I'm not a huge fan of Swing myself except it does provide a lot of capabilities for look and feel and has been tested much more thoroughly than any other GUI framework that I know of.

Renanse, how are you liking FengGUI?  Is there any performance issues with it that you've seen or many bugs?

Not sure, since I don't use it beyond the demos and such.  I like how they do "themes" and font rendering a lot though.

Just thought I'd give you guys an update.



I've managed to get user input to translate properly between the two frameworks.  That was a cinch.

I'm working on drawing problems within FengGUI right now.  Schabby from the FengGUI project has

been encouraging and has offered to look through the code and see what isn't drawing correctly.



I hope to have a nice working demo for you guys here soon.

yeah, Whackjack did a nice job on the input. Works like a charm.



We just started working on the graphics part and we are encountering a little oddity: If the scene graph is empty FengGUI is rendered as expected. However, adding a simple box (not textured), the textures rendered in FengGUI are not mapped anymore. The stuff we render with GL_TEXTURED_2D disabled is rendered properly however.



FengGUI is basically resetting all gl states/properties before it starts rendering the UI. It appears to me as if we forget to reset a certain texture related parameter that causes the textures to fail. Any ideas?



Johannes



edit: we are rendering FengGUI after we call display.getRenderer().draw(rootNode); (LWJGL).

It works when we make jME load a texture…



Here is a snapshot of FengGUI rendered on top of jME:



Niiiiiice…



You can reset jME's renderstates with Renderer.clearCurrentStates() and Renderer.applyDefaultStates().



But if you wait with FengGUI till after the renderqueues are done it shouldn't be a problem.

I added some code between the called to display.getRenderer().draw(rootNode) and the FengGUI call.

Both of the calls Renderer.clearCurrentStates() and Renderer.applyDefaultStates() fail to make a difference.

I also added a call in there to display.getRenderer().isProcessingQueue() and it returns false.

Perhaps some other flags aren't being set…



display.getRenderer().clearBuffers();
display.getRenderer().draw(rootNode);
Renderer.clearCurrentStates();
Renderer.applyDefaultStates();
if(!dumped)
{
   System.out.println("isProcessingQueue? " + display.getRenderer().isProcessingQueue());
   dumped = true;
}
// Then we display the GUI
disp.display();

Since it works when you enable a texture, I'd guess it's something done in LWJGLTextureState (but only when there's a texture) that makes FengGUI happy. Maybe something as simple as enabling the texture unit?

isProcessingQueue is not going to ever return true in that location of the code.  Try explicitly calling a display.getRenderer().renderQueue() after your draw(rootNode) and before you clear and apply.  That will ensure the queue is processed if you are using the queue at all.

Since it works when you enable a texture, I'd guess it's something done in LWJGLTextureState (but only when there's a texture) that makes FengGUI happy. Maybe something as simple as enabling the texture unit?


Err... terminology problem: what do you mean by "texture unit"?  :) I agree that it is probably something obvious. The odd thing is that FengGUI is running fine as a stand-alone LWJGL app.

The myircal call is box.setRenderState(display.getRenderer().createTextureState());.

I am downloading the jME sources right now. What's the best way to find out what exact openGL calls jME is dropping?

Johannes