MikePopoloski / SharpBgfx

C# bindings for the bgfx graphics library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use TransientVertexBuffer

KrzysztofMajor opened this issue · comments

Could you please write an example how to fill TransientVertexBuffer. It's straight forward in C++ but not so obvious in C#

What exactly are you having trouble with?

The idea is that you allocate one on the stack each frame, copy data to its IntPtr Data member, and then call SetVertexBuffer on it to bind it and render from it.

If you're not sure how to copy to an IntPtr, there are many different ways in C#. See Marshal.Copy, Buffer.MemoryCopy, or just cast it to a pointer and then set vertex data directly.