NullPointerEx. when attempting to access any LWJGL->G11 method

Hi, I'm new to jME, but I have already made a few simple apps (It's very user friendly, with quick ramp-up)  :slight_smile:

However, I have recently tried to make a little more sophisticated app.  (One that has a StandardGame and a custom BasicGameState)

But whenever I try to initialize the game, I run into NullPointerExceptions whenever any G11 method is called (by the LWJGL wrapper)

It's as if the OGL renderer isn't initialized yet, but I don't see what I'm doing differently.



Here's the excp:

Exception in thread "main" java.lang.NullPointerException
at org.lwjgl.opengl.GL11.glHint(GL11.java:1508)
at com.jme.scene.state.lwjgl.LWJGLTextureState.apply(LWJGLTextureState.java:420)
at com.jme.scene.Skybox.preloadTextures(Skybox.java:271)
at com.atmosfear.MyGameState.buildSkyBox(MyGameState.java:398)
at com.atmosfear.MyGameState.simpleInitGame(MyGameState.java:89)
at com.atmosfear.MyGameState.<init>(MyGameState.java:57)
at com.atmosfear.MyGameState.<init>(MyGame.java:22)
at com.atmosfear.MyGame.main(AtmosFear.java:6)


I copied the code from the TestIsland Example, and put all that code into my custom GameState, so that it will initialize upon creation.  Is that not correct?

Here is the code block to create my StandardGame/State:

   StandardGame game = new StandardGame("Carcassonne");
      game.start();

      gameState = new MyGameState(game);
      
      DebugGameState debugGameState = new DebugGameState();
      GameStateManager.getInstance().attachChild(debugGameState);
      debugGameState.setActive(true);

      GameStateManager.getInstance().attachChild(gameState);
      gameState.getRootNode().updateRenderState();
      gameState.setActive(true);



The code in MyGameState.<init> is pretty much copied right out of the example, but with all the right variables extracted from the "game" constructor parameter.

Any help would be greatly appreciated.  (I love jME BTW)

cheers.

I figured out the problem.      I had to execute the initialization in the GL thread.  Ok, all good now.