Original Post
I've recently started refactoring my renderer to use dynamic vertex buffers instead of creating a static vertex buffer per mesh and destroying/recreating it everytime the object is changed. I'm not sure why, but I think that should improve the renderer's performance slightly. ;)
I do want to write something efficient rather than just having "dynamic vertex bufferz loel!!" in my games, though. What I understand is that I'm to create a large dynamic VB, write vertices into it, dump it once it's full, and then flush the contents and start over. So that means I need to have a local copy of my meshes at all times.
I'm under the impression it'd be better to keep any mesh in the scene loaded in the buffer and for the object to store an index to its vertices. That way, the overhead of copying the vertices into the buffer each frame wouldn't be incurred and all updating could be done by locking the buffer only once. But somehow this doesn't feel right (I understand a dynamic VB's contents are intended to be regularly discarded...) and I feel like I'd run into unpleasant problems (such as dealing with buffer "fragmentation" as objects are moved in and out of it)...
So, I suppose I'm just looking for some advice as to how to proceed, really.
I do want to write something efficient rather than just having "dynamic vertex bufferz loel!!" in my games, though. What I understand is that I'm to create a large dynamic VB, write vertices into it, dump it once it's full, and then flush the contents and start over. So that means I need to have a local copy of my meshes at all times.
I'm under the impression it'd be better to keep any mesh in the scene loaded in the buffer and for the object to store an index to its vertices. That way, the overhead of copying the vertices into the buffer each frame wouldn't be incurred and all updating could be done by locking the buffer only once. But somehow this doesn't feel right (I understand a dynamic VB's contents are intended to be regularly discarded...) and I feel like I'd run into unpleasant problems (such as dealing with buffer "fragmentation" as objects are moved in and out of it)...
So, I suppose I'm just looking for some advice as to how to proceed, really.