[java] Loading raw heightmaps

Started by
1 comment, last by Pirosan 18 years ago
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
Bow before me... for i am l33t!
Advertisement
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;
thank you so much for your help! that totally fixed the problem!
Bow before me... for i am l33t!

This topic is closed to new replies.

Advertisement