Water Question

Sorry if this is a really obvious question, but I want to get the water to work in a base game class, in an environment similar to the flag rush games, am I missing an obvious way of doing this?? Any help is much appreciated.

Could you be (a lot) more specific please? What is exactly what is not working?

Take into account that you will need a render pass manager to render the water properly.

I think that might the problem, I was trying to find a way of making a simple water terrain, so whilst this one in flag rush

    private void buildTerrain() {
        MidPointHeightMap heightMap = new MidPointHeightMap(64, 1f);
        // Scale the data
        Vector3f terrainScale = new Vector3f(4, 0.0575f, 4);
        // create a terrainblock
         tb = new TerrainBlock("Terrain", heightMap.getSize(), terrainScale,
                heightMap.getHeightMap(), new Vector3f(0, 0, 0), false);

        tb.setModelBound(new BoundingBox());

        // generate a terrain texture with 2 textures
        ProceduralTextureGenerator pt = new ProceduralTextureGenerator(
        pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
                .getResource("jmetest/data/texture/grassb.png")), -128, 0, 128);
        pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
                .getResource("jmetest/data/texture/dirt.jpg")), 0, 128, 255);
        pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
                .getResource("jmetest/data/texture/highest.jpg")), 128, 255,
        // assign the texture to the terrain
        TextureState ts = display.getRenderer().createTextureState();
        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
                Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
        ts.setTexture(t1, 0);


Creates the flat terrain in the flag rush tutorials, I was trying to get a simple way of creating water using a similar method within a class that extends BaseGame, I am getting a load of null pointer exceptions, so i was wondering if it was possible, or if there was something really stupid i am doing wrong, is it possible?

I would strongly suggest to have a look at TestIsland and TestProjectedGrid TestProjectedWater examples to see if they make sense to you. These are the definitive resource for water rendering in jME.

Thanks, I will do that