I'm playing around with OpenGL ES 2 and FloatBuffers. Actually i try to save the FloatBuffer handling the Vertices Data to a binary file. It seems to work but after reading in the floats and puting them back togehter to a FloatBuffer the object is messed up.
For saving the float data from my Buffer i use the following code:
for(int i = 0; i < bufferSize; i++)
outStream.writeFloat(floatBuffer.get(i));
For reading:
for(int i = 0; i < bufferSize; i++)
if(inStream.available() != 0)
tmpFloat[i] = inStream.readFloat();
FloatBuffers are created this way:
FloatBuffer VertexBuffer = ByteBuffer.allocateDirect(VertexFloatArray.length * mBytesPerFloat).order(ByteOrder.nativeOrder()).asFloatBuffer();
VertexBuffer.put(VertexFloatArray).position(0);
Does anyone have a idea why this happens?
UPDATE: I already compared the data written and readed and they are equal. The problem is still there and this is just more confusing.