Lately, I've been trying to draw multiple objects with Direct3D and I just don't understand how I'm supposed to draw different objects on the screen with multiple vertex buffers. On MSDN, I read that a GPU could only hold 16 vertex buffers, so creating one vertex buffer per object doesn't make much sense to me. I know it is possible to put many static meshes into a single vertex buffer, but since mine are dynamic, how am I supposed to do that?
How to draw multiple objects with Direct3D?
Moderators - Reputation: 40943
Posted 17 August 2014 - 11:21 PM
You can make use of 16 buffers simultaneously -- as in, when drawing one object, you can read data from up to 16 buffers.
On MSDN, I read that a GPU could only hold 16 vertex buffers... [within each draw call].
The next object can use the same buffer(s), or a completely different set of 0-16 buffers.
Members - Reputation: 1165
Posted 18 August 2014 - 03:23 PM
For each of my game objects every frame I add an entry in a list of renderables. Renderables are just a structure storing information about the object, like its vertex/index buffers, materials, sorting parameters, etc. and every frame I iterate through the list and draw them one at a time, setting the vertex buffer for each one when I draw it.