glDrawElements

Hello, I’m new to JOGL

I want to draw some geometry calling glDrawElements(), but for the ‘type’ arguments only accpets unsigned types. So what I did was to load a model(3ds) from C++ and then save it as raw data in a file.
The number of vertex and the number of faces are stored as ‘int’ and I can read them correctly from Java. The vertex and normals are stored as floats(c++, little endian), and the faces indices as unsigned int.
What I see in the screen are a very messy collection of triangles. But…, I also can see some geometry that is being drawn correctly, and also the vertices are not random, they are all in the area of the model(a rolled necklace), So I guess the problems is just with the indices. What is the correct way to load them?

I’m calling rewind on all the buffers, ans also compact

Signed vs. unsigned is almost never an issue. The problem is likely that your indices are incorrect. Some file formats allow different indices for vertices, normals, etc. OpenGL does not. So you may need to re-hash your model data so that the indices are all the same for the vertex and normal data.

Oh thank you. I already solved the problem, I was using memcpy from C++, but there is something wrong :S. the problem was not in the indices, instead it was in the vertexs!. now I’m copying the data with a loop and everything works fine. Thank you.