Skybox problem's in PhysicsGameState

Hi guys!

I'm trying to create a skybox in my class that extends PhysicsGameState and i get the error:

   at org.lwjgl.opengl.GL11.glGenTextures(
   at com.jme.scene.state.lwjgl.LWJGLTextureState.load(
   at com.jme.scene.state.lwjgl.LWJGLTextureState.apply(
   at com.jme.scene.Skybox.preloadTextures(

My skybox code is correct because i used it in a classe extended from SimplePassGame and worked fine.

What is the problem? I can only use skybox in simplepassgame??

Don't use the Skybox.preloadTextures() method inside the gamestate's constructor. This is a known problem and darkfrog has refused to fix it when I asked him about it 2 years ago.

refused to fix it ?  :roll:

The problem is that it some Methods need to be called inside the opengl thread.

You need to use a GameTaskQueue to execute those methods in the correct thread.

The Wiki has a lot of info about StandardGame / Threads / GameTaskQueue

There is also a incomplete list of Methods which need to be called inside the opengl thread.

Thank's guys!

Like Core-Dump said, i needed to create a GameTaskQueueManager so i put my preloadTextures method inside it.

        Callable<Object> preload = new Callable<Object>() {
            public Object call() throws Exception {
                return null;

Now it work's fine!! Thanks again!