jME on a JPanel

I am working on a PROC and I need to be able to put the rendering context on a JPanel. I know this has been done because of the scene creator.



Xith makes it REALLY easy to do but I REALLY would prefer to use jME. Can someone point me in the right direction on getting this done? And is the solution more of a hack or is it solid?



Thanks.

Well, we have a solution for putting it on a JPanel (see the Swing Test)… It’s a hack in that the Swing panel is updated via a pixel grab from the buffer. It works, but can be slowish.



That said… LWJGL’s Cas has said that Swing support will be soon (He before swore LWJGL wouldn’t have it and that’s why we went the route we did.) When they add that support into LWJGL as a self contained feature (rather than his previous suggestion to init with JOGL and then use LWJGL) then we’ll switch over to that method.

"renanse" wrote:
Well, we have a solution for putting it on a JPanel (see the Swing Test)... It's a hack in that the Swing panel is updated via a pixel grab from the buffer. It works, but can be slowish.

That said... LWJGL's Cas has said that Swing support will be soon (He before swore LWJGL wouldn't have it and that's why we went the route we did.) When they add that support into LWJGL as a self contained feature (rather than his previous suggestion to init with JOGL and then use LWJGL) then we'll switch over to that method.

I was under the impression that LWJGL really wanted to drop window support all together, let alone provide a mechanism for connecting to a JPanel. Is that not the case anymore? I haven't been to their forums in a while. I really need to get this done though so I might be forced to use Xith for now.

Dern. Plus my whole CVS issue so I can't even grab the source for all the examples. Bah! :)

Well, if you do get cvs working, check out the Swing Test before you give up completely. jmetest.util.JMESwingTest



Also, yeah, they change their minds a lot. :slight_smile: Windows are fine and some kind of Swing support is supposedly forthcoming.

"renanse" wrote:
Well, if you do get cvs working, check out the Swing Test before you give up completely. jmetest.util.JMESwingTest

Thanks, I will.

Let me know if you have probs with the test.

"renanse" wrote:
Well, if you do get cvs working, check out the Swing Test before you give up completely. jmetest.util.JMESwingTest

Also, yeah, they change their minds a lot. :) Windows are fine and some kind of Swing support is supposedly forthcoming.

And that is funny because for the longest time they were so anti-swing. I mean, they got nasty with people talking about it.

"LWJGL is not a GUI toolkit. We don't want to support widgets, bla bla".

Guess they finally caved. Of course, JOGL supports it and has sense day 1. ;)

New idea. Well, I’m sure someone has done it but I can’t find it. Anyway, instead of putting the context on a JPanel, what if I had a GUI with all my controls and just opened a regular jME window? I know I can do this. My question though is how hard would it be to pass data between my GUI and the jME window?

Our particle editor works exactly like this and works very well. http://www.jmonkeyengine.com/webstart/jmedemo.php?effects.RenParticleEditor



see if that is what you’d like to see.

"mojomonk" wrote:
Our particle editor works exactly like this and works very well. http://www.jmonkeyengine.com/webstart/jmedemo.php?effects.RenParticleEditor

see if that is what you'd like to see.

That looks great. I'll have to do some testing and see what I can come up with. Since I can't grab CVS right now to look at the source code, is there a breif explaination of the communication between the GUI and the context? Do you just give the GUI a reference to the JME window. Say something like:


//button action to open a new jme context
JMEWindow app = new JMEWindow //JMEWindow extends SimpleGame
app.start();



And then give that app object to whatever needs it?

Here are the two classes that handle this application:



https://jme.dev.java.net/source/browse/jme/src/jmetest/effects/RenParticleEditor.java?rev=1.9&view=auto&content-type=text/vnd.viewcvs-markup



and



https://jme.dev.java.net/source/browse/jme/src/jmetest/effects/RenParticleControlFrame.java?rev=1.34&view=auto&content-type=text/vnd.viewcvs-markup