Original Post
Hi I am trying to read a MD2-file into my little engine but are getting some strange values. My function to read a integer from a DataInputStream looks something like this:
byte[] buffer = new byte[4];
inputStream.read(buffer, 0, 4);
int result = (buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24)); // Little Endian And in my MD2-header loading functions I just read one integer at a time, but I get these results: Quote:Seems like the magic number and the version is OK. And the Skin width/height also. But the rest looks kinda screewed. Am I missing out of some unsigned to signed conversion?
MD2 Header: Magic Number: IDP2 Version: 8 Skin Width/Height: 256/256 Frame Size: 552 Num Skins: 0 Num Vertices: -128 Num Tex Coords: -91 Num Triangles: -18 Num OpenGL Commands: 2381 Num Frames: -74 Offset Skins: 68 Offset Tex Coords: 68 Offset Triangles: -40 Offset Frames: 3584 Offset OpenGL Commands: -27024 Offset EOF: -92