I've a class that creates a cube using VertexPositionColor and these vertices are stored in a VertexBuffer. Now i would like to dynamically change the color of my vertices. In my class i have a reference to a VertexPositionColor array wich contain all my vertices. I've wrote a SetColor function wich accept a Color in parameter and update each Color property of my vertices. But when i call it, it doesn't work. This is normal because vertices are stored in VertexBuffer and is not updated.
So, how can i update vertices property and keep using VertexBuffer?
SetData(vertices)on the vertex buffer after you have modified the data. It's best to do this only once a frame, IF the data has been modified. – Jonathan Dickinson Oct 9 '11 at 11:19DynamicVertexBuffer- you shouldn't be using a regularVertexBufferfor dynamic data. – Jonathan Dickinson Oct 9 '11 at 11:20