Add uint overload for BufferData to OpenGLExtensions
Dear Sir
I'm really grateful for the ushort[] and float[] overload to BufferData, as I previously had no experience with IntPtr's. So this was a good example to get started with it. But for larger data (>65k) ushort is not an option as index buffer. So could you consider adding a uint overload as well. I created an extension method for it at the moment.
I think you can just copy paste this into OpenGLExtensions:
public void BufferData(uint target, uint[] data, uint usage)
{
var dataSize = data.Length * sizeof(uint);
IntPtr p = Marshal.AllocHGlobal(dataSize);
var intData = new int[data.Length];
Buffer.BlockCopy(data, 0, intData, 0, dataSize);
Marshal.Copy(intData, 0, p, data.Length);
InvokeExtensionFunction<glBufferData>(target, dataSize, p, usage);
Marshal.FreeHGlobal(p);
}
Kind regards, Jochem.
Hi Jochem,
Thanks for getting in touch and the code sample - I will include it in the next release :)
I have implemented it on my version, pretty quick. There is a little drop of FPS du to the 32 bits dataset but it works fine with around 50FPS for large meshes. (I couldn't find any Dll with that option for SharpGL)