Sign in to follow this  
Pirosan

[java] Loading raw heightmaps

Recommended Posts

Pirosan    124
Hey there, i'm looking into loading heightmaps into my java application, but I don't know how to go about loading the data. I see the two kings (http://www.two-kings.de/tutorials/terrain/terrain01.html) gathers the data and places it into an unsigned char array. When trying to load it in java, I am not getting the same results, and even if i pattern the raw file (i'm saving it using photoshop), i don't seem to get data that is consistant with the image. How should i go about doing this? cheers

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
A byte in Java is signed when you convert it to other types, e.g. float, convert the value to a int first and AND:ing with 0xFF.

int val = (int)byteVal & 0x00FF;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this