VM crash in loadTexture using JMEDesktop

Hi,



i have a problem that my VM is crashing if i'm trying to change a texture on a button click from a JMEDesktop.



Using current cvs of jme on  Fedora Core 4, JRE 1.5.0 Update 6, Nvidia drivers.



VM dump


Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J  com.jme.scene.state.lwjgl.LWJGLTextureState.apply()V
v  ~RuntimeStub::alignment_frame_return Runtime1 stub
j  com.jme.util.TextureManager.loadTexture(Ljava/net/URL;IIIFZ)Lcom/jme/image/Texture;+243
j  com.jme.util.TextureManager.loadTexture(Ljava/net/URL;II)Lcom/jme/image/Texture;+17
j  de.fishheadsoftware.client.Player.loadNewTexture(Ljava/net/URL;)V+68
j  de.fishheadsoftware.client.ResourceWindow$4.actionPerformed(Ljava/awt/event/ActionEvent;)V+68
j  javax.swing.AbstractButton.fireActionPerformed(Ljava/awt/event/ActionEvent;)V+84
j  javax.swing.AbstractButton$Handler.actionPerformed(Ljava/awt/event/ActionEvent;)V+5
j  javax.swing.DefaultButtonModel.fireActionPerformed(Ljava/awt/event/ActionEvent;)V+35
j  javax.swing.DefaultButtonModel.setPressed(Z)V+117
j  javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Ljava/awt/event/MouseEvent;)V+35
j  java.awt.AWTEventMulticaster.mouseReleased(Ljava/awt/event/MouseEvent;)V+8
j  java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V+64
j  javax.swing.JComponent.processMouseEvent(Ljava/awt/event/MouseEvent;)V+23
J  java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V
v  ~RuntimeStub::alignment_frame_return Runtime1 stub
j  java.awt.Container.processEvent(Ljava/awt/AWTEvent;)V+18
J  java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V
J  java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V
J  java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V
v  ~RuntimeStub::alignment_frame_return Runtime1 stub
j  javax.swing.plaf.basic.BasicInternalFrameUI$Handler.retargetMouseEvent(ILjava/awt/event/MouseEvent;Ljava/awt/Component;)V+74
j  javax.swing.plaf.basic.BasicInternalFrameUI$Handler.forwardMouseEvent(Ljava/awt/event/MouseEvent;)V+348
j  javax.swing.plaf.basic.BasicInternalFrameUI$Handler.mouseReleased(Ljava/awt/event/MouseEvent;)V+2
j  java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V+64
j  javax.swing.JComponent.processMouseEvent(Ljava/awt/event/MouseEvent;)V+23
J  java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V
v  ~RuntimeStub::alignment_frame_return Runtime1 stub
j  java.awt.Container.processEvent(Ljava/awt/AWTEvent;)V+18
J  java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V
J  java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V
J  java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V
j  com.jmex.awt.swingui.JMEDesktop.dispatchEvent(Ljava/awt/Component;Ljava/awt/AWTEvent;)V+37
j  com.jmex.awt.swingui.JMEDesktop.sendAWTMouseEvent(IIZI)V+474
j  com.jmex.awt.swingui.JMEDesktop.access$9(Lcom/jmex/awt/swingui/JMEDesktop;IIZI)V+6
j  com.jmex.awt.swingui.JMEDesktop$6.run()V+20
j  java.awt.event.InvocationEvent.dispatch()V+11
j  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+26
j  java.awt.EventDispatchThread.pumpOneEventForHierarchy(ILjava/awt/Component;)Z+233
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+26
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j  java.awt.EventDispatchThread.run()V+9
v  ~StubRoutines::call_stub
V  [libjvm.so+0x174fec]
V  [libjvm.so+0x2821f8]
V  [libjvm.so+0x174845]
V  [libjvm.so+0x1748de]
V  [libjvm.so+0x1ebee5]
V  [libjvm.so+0x2ea563]
V  [libjvm.so+0x282d08]
C  [libpthread.so.0+0x5b80]



Any idea's?

Greetings MadLion

Make sure all OpenGL related calls come from the same thread, yours are coming from the Swing thread it seemss. OpenGL requires this, but jME itself isn't threadsafe in this respect either; for performance reasons, and since it doesn't need to be threadsafe because OpenGL can't deal with this anyway (as you see).

Llama is right. Have a look at HelloJMEDesktop on how to achieve that (esp. use of JMEAction in there).

Thanks, i didn't really know that.



I will take a look at HelloJMEDesktop and JMEAction. ^^

It's working, thanks!