Very simple (...) StandardGame problem

Hey,



I've just started to look at jME during the last few weeks, I've never done any gaming programming before, but I'd love to try it and this seems to be the place to start.



I have created a very simple terrain block using StandardGame and GameStates, but for some reason I only get about 15 fps.



Culling the scene should improve the fps,



so I added this code:



CullState cs = display.getRenderer().createCullState();
cs.setCullMode(CullState.CS_BACK);
cs.setEnabled(true);
rootNode.setRenderState(cs);



to the constructor of the MyGameState, which extends StatisticsGameState, after setting up the working zBufferState.

I get a NullPointerException for some reason .. I guess it's somthing to do with the openGL thread, but I thought you could initiate everything without having to touch the openGL thread.

The culling works with simple game and base game, I just can't get it working with standard game!

Thanks loads ;)


edit:

Also can't get "skybox.preloadTextures();" to work with my game state :S

Here's the stack trace:

Exception in thread "main" java.lang.NullPointerException
at org.lwjgl.opengl.GL11.glHint(GL11.java:1510)
at com.jme.scene.state.lwjgl.LWJGLTextureState.apply(LWJGLTextureState.java:419)
at com.jme.scene.Skybox.preloadTextures(Skybox.java:271)
at com.zimph.test.BallGameState.buildSkyBox(BallGameState.java:402)
at com.zimph.test.BallGameState.init(BallGameState.java:104)
at com.zimph.test.BallGameState.<init>(BallGameState.java:78)
at com.zimph.test.BallGameState.<init>(BallGameState.java:74)
at com.zimph.test.BallRoll.main(BallRoll.java:22)

You need to put skybox.preloadTextures() in the opengl thread

skyuzo said:

You need to put skybox.preloadTextures() in the opengl thread


I don't really get how do that though :S

I'll have a go, gimme a sec ...



      Future<Object> task = GameTaskQueueManager.getManager().getQueue(GameTaskQueue.UPDATE).enqueue(
              new Callable<Object> () {
                 
                 return null;
              });
        }