I have some questions about a retained api system, renderable items, and their VBO/IBOS.
I'm not sure how to really ask this, so please feel to tell me to explain something if it does not make sense
So with a retained api, you do something like this:
renderSystem.AddRenderItem(sprite1); //Just a basic textured sprite renderSystem.AddRenderItem(sprite2); //Just a basic textured sprite renderSystem.AddRenderItem(cubeModel); //Just a basic cube model
And the render system has list of all the renderable items you added to it. Which it is then responsible for drawing those renderable items using the data they provide. But the part I don't understand is the VBO / IBO implementation portion.
Using the code snippet above, lets say all those renderables use the same shader program.
Where each vertex has the following: XYZ position, UV texture coords
So for me, I would want to put all this data into one giant VBO since its all the same layout/format. Then this is where I get a little lost
What do I do about / how do I handle the indices?
If each renderable has their own indices data, then how does it get factored into the system?
Keeping the idea of using a giant singular VBO, I would think there would be a giant singular IBO.
So how does that index data of each renderable get added into this IBO? Added in the sense that the draw calls are efficient / work. Sure I could just slap it in there and use 3 draw calls (one for each renderable) but that seems bad, especially if I need to start rendering more objects
I think it would be better batch them up, but then does that mean I need to formulate the index data on the fly since everything will be in one IBO? Surely that would be horrible, since models can have their index data exported out and it would be more efficient to use that then doing the above.
If they just get slapped into one IBO, then I would think any overall single draw call would make everything look really messed up.
Since the IBO would pull the vertex ids incorrectly
So how are IBOs supposed to be handled in these kinds of systems? Not necessarily just in this system, but how are they supposed to be handled when you have multiple models with there own unique index data?
Please let me know if I need to explain something better