Jump to content
  • Advertisement
Sign in to follow this  
Pirosan

[java] Loading raw heightmaps

This topic is 4477 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!