Crashe in camera positioning with lwjgl-1.0b

When I install the latest lwjgl, camera positioning code that worked under lwjgl-0.99 gets a NPE in GL11.GLMatrixMode(5888) according to Eclipse debugger under Mac OS X latest.

I'd hoped that upgrading might get at another problem I reported in this forum; see

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

at org.lwjgl.opengl.GL11.glMatrixMode(

at com.jme.renderer.lwjgl.LWJGLCamera.onFrameChange(

at com.jme.renderer.AbstractCamera.setLocation(

at com.binary.nagumo.views.Frame$ControlPane$CameraPane.actionPerformed(

at javax.swing.AbstractButton.fireActionPerformed(

at javax.swing.AbstractButton$Handler.actionPerformed(

at javax.swing.DefaultButtonModel.fireActionPerformed(

at javax.swing.DefaultButtonModel.setPressed(

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(

at java.awt.Component.processMouseEvent(

at javax.swing.JComponent.processMouseEvent(

at java.awt.Component.processEvent(

at java.awt.Container.processEvent(

at java.awt.Component.dispatchEventImpl(

at java.awt.Container.dispatchEventImpl(

at java.awt.Component.dispatchEvent(

at java.awt.LightweightDispatcher.retargetMouseEvent(

at java.awt.LightweightDispatcher.processMouseEvent(

at java.awt.LightweightDispatcher.dispatchEvent(

at java.awt.Container.dispatchEventImpl(

at java.awt.Window.dispatchEventImpl(

at java.awt.Component.dispatchEvent(

at java.awt.EventQueue.dispatchEvent(

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(

at java.awt.EventDispatchThread.pumpEventsForHierarchy(

at java.awt.EventDispatchThread.pumpEvents(

at java.awt.EventDispatchThread.pumpEvents(


45 frames in -1055.919 seconds = -0.042616908 FPS (average)

The exception seems to be caught, printed and ignored somehwere so the app keeps on going

Is JME thought to work under new LWJGL releases?

How should I proceed. I'm a still a noob at JME.

I see that you use a button action to position the camera. With the latest LWJGL this must be in the same thread as the GL context. Therefore, you need to have your button call the GL thread to make the change.

The problem is that lwjgl1.0b has made changes that result in a more strict enforcing of the "only-one-thread-shall-access-opengl" edict.  Thus, anything that might make opengl calls (such as moving your camera) needs to happen inside of the paintGL call.  Yeah, it's a pain, but you can use the new RenderThreadActionQueue and RenderThreadExecutable classes to comply with that restriction.  JMECanvasImplementor has an example of this in it's resizeCanvas method:

    public void resizeCanvas(final int width, final int height) {
        RenderThreadExecutable exe = new RenderThreadExecutable() {
            public void doAction() {
                if (renderer != null)
                    renderer.reinit(width, height);

So basically, inside your actionPerformed method, make that RenderThreadExecutable instance and in it's doAction method, set the location of your camera.

Hope that helps!  I know the pain, trust me.

I'll make a seperate post on this utility to explain some of the ins and outs.

Or simply use JMEAction like shown in HelloJMEDesktop (you don't need to use a JMEDesktop to use it that way).

Thanks, Joshua.

Tried your resizeCanvas example. NPE's gone now. But my actions aren't being drained from the queue. Eclipse show's they're there but the queue isn't being drained. Must be anothe change somewhere I'm missing.

PS: jme.util isn't in any of the jars; at least none of those provided by CVS update. I copied the jme.util dir into my source tree to make this work.

If it's not being drained, you probably aren't using cvs jme (the fact that you copied in source seems to confirm that.)  The drain occurs in LWJGLCanvas, which was updated in cvs yesterday.