Closed jonvaldes closed 10 years ago
The existing function (AttribLocation.AttribPointer) is already capable of accepting and converting a uintptr to an offset. Or do you want that extra function to bypass the runtime reflection?
Well, I totally missed that feature. Thanks for telling me about it!
May I then suggest adding some documentation to that function, as the library source code and examples don't say anything about that capability?
Pull requests welcome!
Closing this one since the original problem is resolved.
According to the OpenGL API docs ( http://www.opengl.org/sdk/docs/man3/xhtml/glVertexAttribPointer.xml ), the "pointer" element in glVertexAttribPointer has been repurposed in OpenGL 3.x to indicate an offset into the currently bound buffer, effectively treating that GLvoid* parameter as a 32/64 bit uint.
In simple cases, a "nil" value is enough to indicate a zero offset, but more complex cases require specific offsets, which because of the go-gl API design are not easy to convey (how to make an interface{} have a 0x00000005 address?)
This is why I believe a modification to the current API is required for this way of using this function.
I propose adding another function with a uintptr parameter, so integer values can be passed directly, just like they are in the C API. The function signature would look something like this:
Here's a diff for a possible implementation of this API change: