Tuesday, November 29, 2022
HomeGame Developmentshaders - Monogame - When to reuse buffers?

shaders – Monogame – When to reuse buffers?


So – how do these work precisely?

Proper now I’m making a buffer and setting the info each body for my object, however I heard you possibly can reuse the buffer, too. If the item shouldn’t be altering in any approach apart from it is place, are you able to reuse the identical buffer each body, or do it’s a must to remake it?

I’ve additionally heard you possibly can merely change the place in a shader – is that this the best way to go?

So far as I am conscious, if the item strikes, it’s good to do that each draw name:

vertexbuff = new VertexBuffer(GraphicsDevice, VertexPositionColor.VertexDeclaration, _vertices.Size, BufferUsage.WriteOnly);
vertexbuff.SetData(_vertices, 0, _vertices.Size);
GraphicsDevice.SetVertexBuffer(vertexbuff);

At the least, that is the way it labored once I tried. Is there a approach not to do that each body or am I approaching this the one approach doable?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments