Problem creating model twice relating to LWJGLTextureState

Hello, in my game, when I try to either clone a model twice, or load the same model twice, I get a crazy null pointer exception relating to LWJGLTextureState:

at com.jme.scene.state.lwjgl.LWJGLTextureState.<init>(Unknown Source)
at com.jme.renderer.lwjgl.LWJGLRenderer.createTextureState(Unknown Source)
at com.jme.scene.Geometry.<init>(Unknown Source)
at com.jme.scene.TriMesh.<init>(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryReader.readBegining(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryReader.loadBinaryFormat(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryReader.loadBinaryFormat(Unknown Source)

It loads fine the first time but the second time it does not load. This happens with both 3DS models and Milkshape models. However, when I run jme's TestModelClones, everything works fine. This leads me to believe the problem is on my end... probably an image problem.

Each model loads its texture's from a JPG RGB, 72 DPI file (512x512). I have a Radeon 9000 Pro card, and am running OS X 10.4.

Using debug output (read: System.out.println everywhere) from within the constructor to LWJGLTextureState I was able to isolate the line where it crashes, it is right after the call to super():
supportsMultiTexture = (GLContext.getCapabilities().GL_ARB_multitexture && GLContext.getCapabilities().OpenGL13); // crashes on this line!

Any help with this problem would be GREATLY appreciated as it is holding back the further development of my game.

Check if GLContext.getCapabilities() is returning null… this can happen in cases where more than one thread accesses OpenGL at one time. (I know from first hand experience… )

"renanse" wrote:
Check if GLContext.getCapabilities() is returning null... this can happen in cases where more than one thread accesses OpenGL at one time. (I know from first hand experience... )
As usual you're at the top of your game renanse, hitting the nail on the head on your first try. Thanks! :)


I have a similar problem in my app, when I use the fonction

    com.jme.renderer.lwjgl.LWJGLRenderer.LWJGLRenderer(int width, int height),

who call GLContext.getCapabilities(), but it is returning null.

I don't think I have more than one thread who access OpenGL,

So anybody know an other reason for getCapabilities() returning null?