I'm thinking about tweaking my current batch render. What I currently do is run a loop with command like this :
shader->setUniformValue("mvp_matrix", matrix * geo[x].geoMatrix);
glDrawElementsBaseVertex(GL_TRIANGLES, meshIndicesCountList[x], GL_UNSIGNED_INT, (const GLvoid *) (skip * sizeof(unsigned int)), offsetVertex);
Essentially I have 1 HUGE VBO, or more like 3 (vertex/normals/indices) and I use 1 VAO to bind it all & render. The current render also works on the idea of 1 material = list of meshes in 1 vao/3 VBOS(vert/norm/indices).
Works great, but what I want to do now is to create a vector and then have each VBO holding at max of 500k indices. The idea is to split 1 big buffer in to multiple smaller ones, so that if user change material then I don't have to rebuild entire massive VBO but just one of the smaller ones. Say a 100mil polygons, 50k objects. Might take a while to rebuild... I think I measured it, it was few seconds.
So the question is, given the command I use to run the loop above to draw the objects. Can I somehow still use it to draw the sub VBO's somehow? The command above give offset/vertex starting point of each item in VBO, but I don't see a way to specify which VBO should I use if I bind multiple VBO's under 1 VAO. Or perhaps I should have 1 VAO per 1 VBO list(or struct containing all VBO's), and then bind each VBO in loop and then call draw? I'm just bit worried that with 10k binds of VBO's I would lose the performance, and not gain much of speedup when replacing entire VBO?
Hope this somehow... explain the "issue".