Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inability to pass null to bufferData/namedBufferData #23

Closed
silversquirl opened this issue Jun 2, 2021 · 0 comments
Closed

Inability to pass null to bufferData/namedBufferData #23

silversquirl opened this issue Jun 2, 2021 · 0 comments

Comments

@silversquirl
Copy link
Contributor

A null pointer can be used to create an uninitialized buffer, however zgl's wrappers do not support this.
I propose changing the signatures like this:

pub fn bufferData(target: BufferTarget, comptime T: type, count: usize, items: ?[*]align(1) const T, usage: BufferUsage)

(and in the corresponding manner for namedBufferData)

This allows passing slices using bufferData(target, T, slice.len, slice.ptr, usage), and allows creating uninitialized buffers using bufferData(target, T, length, null, usage).

This has the disadvantage that the API becomes less clear for the usual case. Another alternative would be to create a separate wrapper function for creating uninitialized buffers, but this seems cluttered to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants