Sorry guys, I did not know where else to post this question. There should be a General Programming group.
Anyways, maybe someone here can help me.
Working on some basic terrain, I desire to use a greyscale RAW image to use as the heightmap. However, I'm having issues loading the data. I have a piece of C code that loads RAW in the following way:
1 2
| char* data; fread(data, 1, size * size, file); |
where size is the dimensions of the RAW (i.e. 128x128). I attempted to do the same in Java as follows:
1 2 3 4
| Byte[] heightData = new Byte[size * size]; fis = new FileInputStream(filename); BufferedInputStream bis = new BufferedInputStream(fis); bis.read(heightData); |
This reads the data, but the values are way off, about half are negative.
Any pointers?
Thanks.