Closed schn4v1d closed 6 years ago
Other than disposing the stream and buffers and creating new ones of course
You can update the data inside of a vertex or index buffer by calling their SetData()
methods. For buffers which are going to be dynamically updated after they're created, it's best to use the DynamicVertexBuffer
and DynamicIndexBuffer
classes so that the graphics subsystem can configure them for best performance.
This is how SpriteBatch
works internally; check out FlushSprites()
for an example of how it works. This code actually uses SetDataAligned()
as an optimization for this use case, but the idea is the same.
Thank you very much!
I've recently picked up your framework as it looks very promising.
In your tutorial for Rendering Geometry you showed assigning vertices to a buffer -> a stream etc. As far as I understand it these vertices are then not modifiable. Is it possible to dynamically change the vertices and the amount of vertices inside a stream in the OnUpdate Method?