Is there a way to block VertexBuffers in XNA?

Looking at the MSDN documentation, I cannot find a way to block VertexBuffers so that I can change my data on the device. Is this possible in XNA?

+3
source share
1 answer

You have several options for modifying the contents of vertex buffers in XNA:

  • VertexBufferhas a member SetData. You can safely use this outside Drawanyway where you can activate Predicated Tiling (so it's a good practice to just always do this outside of Draw).

  • DynamicVertexBufferlike VertexBuffer, but faster when setting its contents. However, it is susceptible to the loss of a graphic device, and this condition must be handled. Also take a look SetDataOptions.

  • DrawUserPrimitives(and indexed version). This has advantages that do not affect Predicated Tiling, and without causing a flush of the command buffer for a small number of primitives.

MSDN has more information about Dynamic vertex updates . And this thread on XNA forums might also be worth a read.

+2
source

Source: https://habr.com/ru/post/1757334/


All Articles