I’am relatively new to OpenGL programming and I have a strange problem I couldn’t solve yet.
I wrote a C++ converter-tool which parses an .obj file and generates an OpenGL friendly binary. It writes meshpoints, normals, texcoords and indices with a specific structure into a file to load and draw it with glDrawElements() on an Android device.
If I load this values (and they’re loaded right), my model class doesn’t draw anything!
It’s strange because i’m sure the converter works as arranged!
If I debug the values from the converter and write it directly into the javacode, the model draws perfectly. But if I load my binary and put the values at creation time into the buffers, nothing will be drawn… ???
The loader first gets information about the number of vertices and indices from the file, allocate the buffers and then puts value by value into this buffers (FloatBuffer and ShortBuffer from java.nio.*) by calling vBuffer.put(val). Then it sets the bufferpositions to 0.
My drawing method looks like this (without textures at the moment):
gl.glDrawElements(GL10.GL_TRIANGLES, indexcount, GL10.GL_SHORT, iBuffer);
Do you have any idea why this happens?
There are the same values (debugged already) and the same drawing method but the runtime-loaded model doesn’t draw anything!!!
I hope you have some suggestions because I’m really confused about!
Thanks n peace