Raw height map trouble

here is the code

tell me if u see anything wrong


package com.jme;
import com.jme.app.*;
import com.jme.terrain.*;
import com.jme.math.*;
import com.jme.terrain.util.*;
import com.jme.bounding.*;
public class main extends SimpleGame
{
   public static void main(String args[])
   {
      main app = new main();
      app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
        app.start();
   }
   protected  void simpleInitGame()
   {
      terrianLoad();
      
      
   }
   public void terrianLoad()
   {
      RawHeightMap rhm = new RawHeightMap("test8.raw",257);
      rhm.load();
      TerrainBlock tb=new TerrainBlock("block",1,new Vector3f(1,1,1),rhm.getHeightMap(),new Vector3f(0,0,0),false);
      tb.setModelBound(new BoundingBox());
      tb.updateModelBound();
      rootNode.attachChild(tb);   
   }
}

TerrainBlocks sides are 2^N, TerrainPages are 2^N+1



so size should be 256.



Also, make sure 256 is the size of the side of the RAW.

so couldn’t i just use terrain page and not have to change it

anyways i was getting an error and i was wondering if it was the code

quick look at the console for anybody interested

Apr 27, 2005 3:45:20 PM com.jme.terrain.util.RawHeightMap load

WARNING: Successfully loaded test8.raw

Apr 27, 2005 3:45:21 PM com.jme.terrain.util.RawHeightMap load

WARNING: Successfully loaded test8.raw

java.lang.NullPointerException

at com.jme.terrain.TerrainBlock.buildTextureCoordinates(Unknown Source)

at com.jme.terrain.TerrainBlock.<init>(Unknown Source)

at com.jme.terrain.TerrainBlock.<init>(Unknown Source)

at com.jme.main.terrianLoad(main.java:25)

at com.jme.main.simpleInitGame(main.java:17)

at com.jme.app.SimpleGame.initGame(Unknown Source)

at com.jme.app.BaseGame.start(Unknown Source)

at com.jme.main.main(main.java:13)

Apr 27, 2005 3:45:21 PM com.jme.app.SimpleGame cleanup

INFO: Cleaning up resources.

Apr 27, 2005 3:45:21 PM com.jme.app.BaseGame start

INFO: Application ending.

nvm any of that i got what he was saying and just to let people know jme can’t load 16 bit raw files turns into static and looks like a needle field

the height map is always CRAZY inaccurate any fixes?

??

well ofcorse it’s proble the program i’m using terragen but whats the diffence between terrainblock and terrainpage i tried using it and got array index pointer exception so i gave up then and there

I’ve used Terragen before with no problems. You are going to need to start detailing your questions a lot better than you are if you want people to be able to help you.



As I said before the requirements for TerrainBlocks are heightmaps with sides of 2^N and TerrainPages are 2^N+1. So you must generate a RawHeightMap of the appropriate size for the type you are using. You also have to make sure your RAW image is the size you need.



TerrainBlocks are single mesh objects, brute force rendering of terrain. TerrainPages are basically a Quadtree.

thx