After writing some code to load a 3ds mesh (using lib3ds) I found that rendering using indices caused problems, at least for me. After storing all the vertex data into one array. I divide each lib3dsMesh into my own Submesh subclass which stores index data.
My question is what are (if any) the performance differences in storing index data in an array and using it to call glDrawElements:
GLuint* indices;
void draw()
{
...
glDrawElements(GL_TRIANGLES, submesh.i_data.size(), GL_UNSIGNED_SHORT, &indices[0]);
...
}
And using a BufferObject to store them
GLuint* indices;
...Fill array...
void build()
{
glGenBuffers(1,&ibo);
...Fill buffer...
}
void draw()
{
glBindBuffer(GL_ELEMENT_ARRAY,...);
...
glDrawElements(GL_TRIANGLES, submesh.i_data.size(), GL_UNSIGNED_SHORT, <submesh offset>);
...
}