Everything is inside out on standard game

I just can’t figure this out.



Everything is inside out. Ignore the missing textures, i’ve moved stuff since i last ran the top program. But the angle is almost the same. It is however, using the exact same models without change. The biggest difference between the two is that one is done using simplegame, the other using standardgame and gamestates. But I dont’ know what I did wrong. I’ll post some code later.



Good:







Bad:


At first glance it appears you are missing a ZBufferState on the root node. A second possibility is incorrect cullstate settings, but I think the first is more likely.

I agree…



check in this order:



ZBufferState

CullState

Missing an UpdateGeometricState

Missing an UpdateRenderState

Checking… it looks like it happens once i apply a texture.

Main app


        StandardGame app;
        if (gametype == CLIENT) {
            app = new StandardGame("client"); // Create Object
            Logger.getLogger(tmpMaelori.class.getName()).setLevel(Level.OFF);
        }else{
            app = new StandardGame("Dedicated Server", StandardGame.GameType.HEADLESS);
            Logger.getLogger(tmpMaelori.class.getName()).setLevel(Level.OFF);
        }
        app.start(); // Start the program

        tmpCodeTester tmpGS = new tmpCodeTester("tmp Tester");
        GameStateManager.getInstance().attachChild(tmpGS);
        tmpGS.setActive(true);





   
        Node scene = new Node("Scene graph node");
        URL model = tmpCodeTester.class.getClassLoader().getResource("data/models/BF.obj");
        FormatConverter converter = new ObjToJme();
        // Point the converter to where it will find the .mtl file from
        converter.setProperty("mtllib", model);
       
        //load model
        ByteArrayOutputStream BO = new ByteArrayOutputStream();
        try {
           
            // Use the format converter to convert .obj to .jme
            converter.convert(model.openStream(), BO);
            TriMesh battlefield = (TriMesh) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
           
            // shrink this baby down some
            battlefield.setLocalScale(0.5f);
            battlefield.setModelBound(new BoundingSphere());
            battlefield.updateModelBound();
           
           
            TextureState tsTmp = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();

            URL urlTmp = tmpCodeTester.class.getClassLoader().getResource(
                "data/textures/battlefield/board2.tga"
            );

            Texture baseMap = TextureManager.loadTexture(urlTmp, Texture.MM_LINEAR, Texture.FM_LINEAR);
            baseMap.setWrap(Texture.WM_WRAP_S_WRAP_T);
            tsTmp.setTexture(baseMap);
                               
            battlefield.setRenderState(tsTmp);
           
            // Put her on the scene graph
            scene.attachChild(battlefield);
        } catch (IOException e) {   // Just in case anything happens
           
            System.out.println("Damn exceptions!" + e);
            e.printStackTrace();
            System.exit(0);
        }
        PointLight light = new PointLight();
        light.setDiffuse( new ColorRGBA( 0.75f, 0.75f, 0.75f, 0.75f ) );
        light.setAmbient( new ColorRGBA( 0.5f, 0.5f, 0.5f, 1.0f ) );
        light.setLocation( new Vector3f( 100, 100, 100 ) );
        light.setEnabled( true );
        LightState lightState = DisplaySystem.getDisplaySystem().getRenderer().createLightState();
        lightState.setEnabled( true );
        lightState.attach( light );

        ZBufferState buf = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
        buf.setEnabled( true );
        buf.setFunction( ZBufferState.CF_LEQUAL );
        this.getRootNode().setRenderState( buf );

        scene.setRenderState( lightState );
        //scene.updateGeometricState(0.0f, true);
        scene.updateRenderState();
              
        this.getRootNode().attachChild(scene);       

you are not calling this.getRootNode().updateRenderState();

Boooo. I can't believe it was something that simple.



(I'm booing myself)





Thanks so much. I'll continue to facepalm all day now.

It was on my list  :smiley:

I had to walk through each one of my files as there's about 20+ to find that one of them had a missing update.

Trussell said:

It was on my list  :D


you wish  ;)
dhdd said:

Trussell said:

It was on my list  :D


you wish  ;)


Now you're on the list.
Trussell said:

dhdd said:

Trussell said:

It was on my list  :D


you wish  ;)


Now you're on the list.


hehe  ;)