Error in main class referencing CullState

Hi All, I'm new to jMonkey, and am trying to load a terrain I've created in MW3D. I got some code off the Monkey World forum, and have placed it in my game class. I get an error regarding the CullState class, and when I had a look at this class, I can't find the method used in the code I've picked up.


    public static TerrainPage createHeightMapTerrain(AbstractHeightMap map,
            int size, int blockSize, Vector3f scale, boolean clod) {
        TerrainPage terrainPage = new TerrainPage("Terrain", blockSize,
                size + 1, scale, map.getHeightMap(), clod);
        CullState cs = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
        cs.setCullMode(CullState.CS_BACK);
        cs.setEnabled(true);
        terrainPage.setRenderState(cs);
        return terrainPage;
    }



it's the  cs.setCullMode(CullState.CS_BACK); that's the problem, both the method and the variable CS_BACK is throwing up an error.

I'm new to Java in general, so if I've got terminology wrong I apologize, but it would be nice to get this code working to give me a sense of getting somewhere. Cheers :)

see http://www.jmonkeyengine.com/wiki/doku.php?id=jme_to_jme2_changes for a list of changes between jme1 and 2



CullState.CS_BACK ⇒ CullState.Face.Back
setCullMode() ⇒ setCullHint()

That's great, thanks. Problem is CullHint() still throws up an error, I wonder if things have been updated again? Also TerrainPage() method in the code is throwing up an error, but that's there fine in the TerrainPage class. I'm obviously doing something wrong here, maybe I have something set up wrong, although I have run some test games without a problem in the project. All classes are being imported ok…

Are you using jME 1.0 or 2.0??

jME 2.0

Hi everyone,



i've got the same problem here.

Two errors are still there with setCullHint and new TerrainPage


    public static TerrainPage createHeightMapTerrain(AbstractHeightMap map,
            int size, int blockSize, Vector3f scale, boolean clod) {
        TerrainPage terrainPage = new TerrainPage("Terrain", blockSize,
                size + 1, scale, map.getHeightMap(), clod);
        CullState cs = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
       
        cs.setCullHint(CullState.Face.Back );
        cs.setEnabled(true);
        terrainPage.setRenderState(cs);
        return terrainPage;
    }



anyone got an idea how to solve the problems?
thank you so far!

Solved it!

For anyone, who has this problem too:



    public static TerrainPage createHeightMapTerrain(AbstractHeightMap map,
            int size, int blockSize, Vector3f scale, boolean clod) {
        TerrainPage terrainPage = new TerrainPage("Terrain", blockSize,
                size + 1, scale, map.getHeightMap());
        CullState cs = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
        cs.setCullFace(CullState.Face.Back );
        cs.setEnabled(true);
        terrainPage.setRenderState(cs);
        return terrainPage;
    }