Skybox.preloadTextures() causes weard error

Hai!

I made it so that I click a button, then the game loads.

It works fine, except that it get an error when doing:

skybox.preloadTextures();

It gives:

java.lang.reflect.InvocationTargetException

blah

blah

Caused by: java.lang.NullPointerException

blah

blah



It really didnt point out any specific line, but I tracked it down to that skybox line.

Idk what to do, because If I put that line in comment then

for some weard error I can only see the sky, nothing else…



Someone knows whats wrong?

I tried to do:

Callable<Object> preload = new Callable<Object>() {
            public Object call() throws Exception {
                skybox.preloadTextures();
                return null;
            }
        };
        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).enqueue(preload);


But it only made the error not show, I still cant see anything else than
the background!

I bet the reason no one is ever answering my threads anymore is because you all hate me
because I asked to much, even tho Im not anymore :(

try to search the forum and wiki more, there is a lot of information.



http://www.jmonkeyengine.com/forum/index.php?topic=5912.0

and usually the reason for un answered posts is the lack of enough information about the problem.

I tried doing that and in that method having a call to the init3Dgame

but it still only showed the skybox.

So I added:

GameTaskQueueManager.getManager().getQueue(GameTaskQueue.UPDATE).enqueue(preload);

after the first call to gtm, then I saw a small glimpt of the ground, then it dicappeard…



I suck I know…

But I dont get this with game state manager,…

How do I inactivate my game to start a menustate?

Okej I'v realised whats wrong!

jme renders everything in wrong order!

For example, if I got two boxes

Box 2 is on top of box 1

Then jme renders box 2 first, then box 1, which makes it all look extremly ugly!



I bet that there is a fix method for this riight?, Like : Render closest obj last or something…

Am I right?

I'm not sure what the problem you're having is.

I've never tried preloading a sky box either, so I don't have any experience from that.

The last thing you're asking about though seems to be a ZBuffer problem.

Have you initiated your ZBufferState correctly?


/**
         * Create a ZBuffer to display pixels closest to the camera above
         * farther ones.
         */
        ZBufferState buf = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
        buf.setEnabled(true);
        buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
        rootNode.setRenderState(buf);
rootNode.updateRenderState();

Ahh thanks :slight_smile:

Now I see em!

But, still one problem…

Like every 3rd time I get stackoverflow error…

Am I running something unessecary?

I know its hard to say without much info…

But all that I noticed is that it gets stack overflow if you run one thing at the same time that I start a new thread…

can I like, expand the temporaary meomory of a thread somehow?