In my Swing application, I use different JPanels with a CardLayout to guide user in different steps. So when he go to next step, interface change. This is the main mechanism.
So I need to show the 3D view in different steps, but as there is only one 3D view, I must transfer it (in fact the Canvas) in each Panel.
So I use a basic panel.add(canvas3d) to change it.
When I create 3D view, all is ok, I can see my Duck like this
My problem is when I transfer the Canvas in a different Panel, my textures disappared and duck is black, like if renderer is not initialised. My duck looks like this :
To create Canvas I use :
display.createCanvas(width, height);
LightState seems to be broken
I supposed I must reset Renderer or DisplaySystem, or reinitialise them, but I try to call different functions but without change.
I call a function each time I change step, and I notice that renderer background is reset too. So I must to changeBackground each time. I use this :
Callable<?> call = new Callable<Runnable>() {
public Runnable call() throws Exception {
setBackgroundColor(ColorRGBA.white); // must to set background each time
rootNode.updateGeometricState(0, true);
rootNode.updateRenderState();
Ok, thank you very much, now display works (even if camera doesn't, but it's an other story )
Unfortunatly, I use Jme1.0, and setAutoKillGfxContext is not implemented in LWJGLCanvas. I have seen you did a patch for Jme2.0, so I get code to try and it works, but it's just a test and I am not sure it's perfect, because there are more differences in Jme2.0 Canvas.
So please, can you do a patch for Jme1.0 to add this function, because it's not possible for me to migrate now to Jme2.0 (lot of works is already done) ?
Unfortunatly, jME 1.0 is pretty much 'frozen'; one of the old developers would have to make that change since only they had access to the old CVS…
(although IMO jME 2.0 is WAY better than 1.0, I also had to recently take a large cavas based 1.0 project to 2.0 and was surprised at how painless it actually was. ;))
If it helps here is a bundled canvas and implementer class you can look at or use:
I post a patch and I believe it will be possible to commit it.
I supposed that Jme 2.0 is better, but we have several projects in jme1.0 and we can't migrate for the moment, not enougth time to update hundred of classes.