dwmkerr / dwmkerr/sharpgl

Add uint overload for BufferData to OpenGLExtensions

Open
#35 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
804
Forks
294
Avg merge
3d 23h
Merged PRs (30d)
1

Description

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(target, dataSize, p, usage);
Marshal.FreeHGlobal(p);
}
```

Kind regards,
Jochem.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.