JMECanvas on hidden tab pane

Hi Guys,

I have different modles beign displ;ayed on diferent tabbed pans in Netbeans and in general its working great.

I do have one minor issue though that sometimes when I open a new tabbed pane I get this error:

INFO [com.jme.system.lwjgl.LWJGLDisplaySystem]: LWJGL Display System created.

SEVERE [com.jme.util.GameTask]: Exception


        at com.jme.renderer.lwjgl.LWJGLCamera.doFrameChange(Unknown Source)

        at com.jme.renderer.lwjgl.LWJGLCamera.apply(Unknown Source)

        at com.jme.renderer.lwjgl.LWJGLRenderer.reinit(Unknown Source)

[catch] at com.jmex.awt.JMECanvasImplementor$ Source)

        at com.jme.util.GameTask.invoke(Unknown Source)

        at com.jme.util.GameTaskQueue.execute(Unknown Source)

        at com.jmex.awt.lwjgl.LWJGLCanvas.paintGL(Unknown Source)

        at org.lwjgl.opengl.AWTGLCanvas.paint(

        at sun.awt.RepaintArea.paintComponent(

        at sun.awt.RepaintArea.paint(


        at java.awt.Component.dispatchEventImpl(

        at java.awt.Component.dispatchEvent(

        at java.awt.EventQueue.dispatchEvent(

        at java.awt.EventDispatchThread.pumpOneEventForFilters(

        at java.awt.EventDispatchThread.pumpEventsForFilter(

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(

        at java.awt.EventDispatchThread.pumpEvents(

        at java.awt.EventDispatchThread.pumpEvents(


I assume this means its still trying to render the cnavas thats no longer on screen.  How do I stop it from

doing this?



I'm pretty new to this myself, but you could try calling  .setActive(false); on your GameState - that would stop it from displaying on that GameState until you set it back to true again.

Hmm… some more information…

Apparently it always happens on opening a second canvas if theres already one on screen.

It never happens otherwise.

So it seems I need to shut that one thats onscreen down.  I'll try your suggestion, thanks.

Well… I have no Game State, this a Swing app 8)

But there must be a control here somewhere  in what I DO have…

just browsing through the documentation the only other methods I can see that might help are



in your LWJGLRenderer (you should have one of those even if you're displaying on an awt.Canvas I believe?).  I can't say if they'll do anything for you though, since I haven't played with them myself.  Sorry I couldn't be of more help

Nope doesnt help.

I also cant short circuit render  in my panel that contains the canvas because its getting called directly

from the AWT repaint code.


The problem is that lwjgl's AWTCanvas.paint() is calling LWJGL.paintGL() in the case of  a second (and later) canvas's creation before its really ready to render.

I'm not convincd this is the RIGHT fix, but adding the following test in LWJGLCamera.doFrameChange() fixes the problem in this case:

 // set view matrix
            RendererRecord matRecord = (RendererRecord) DisplaySystem.getDisplaySystem().getCurrentContext().getRendererRecord();
            if (matRecord == null){