I am writing a little game, in C++, using OpenGL. I have a varying number of enemies that are identical objects; each one uses the same animated mesh and shader, with skinning performed by GLSL-shader. I need to draw all of these objects at once, and I am confused about the fastest and most convenient way to do it.
I see several ways to solve my problem:
Creating a single Vertex Buffer Object (VBO) for the vertices and indices, and binding it to a Vertex Array Object (VAO) to draw it ten times by ten draw calls. In this way, after creating the VBOs we, can free the memory that stores the mesh vertices in the RAM, because we don't need it anymore.
Upload all of the meshes into a single VBO for the vertices and indices, and draw this VAO at once. In this case, there is a need to add a lot of additional info, such as the attributes such as position of the mesh, bone matrices, etc. In this case, we continue to store vertex info in the RAM, in order to add vertex data into that global VBO.
Upload all of the meshes into a single VBO for the vertices and indices, and bind it to a VAO. This time, we draw models one by one, sending uniforms for uniform skinning and animation for each model before the draw call. Like in the previous case, we store mesh vertices in the RAM.
Using instancing - passing a uniform array of bone transform matrices and accessing it within the shader by instance id. In this case, we might get rid of the CPU-side mesh data, as we don't need it anymore; much like with the first option. I'm not sure about this option, because instancing is usually used for drawing a large number of mesh instances, rather than drawing 10 instances.
I'm currently not sure which method is faster, and just overall convenient. What is the fastest and most convenient way to draw a number of identical objects at once in OpenGL?