The specification for the glVertexAttribPointer
is as follows:
void glVertexAttribPointer( GLuint index,
GLint size,
GLenum type,
GLboolean normalized,
GLsizei stride,
const GLvoid * pointer);
Given that the last parameter is just a 4-byte integer offset, why does OpenGL expect it to be passed in as a void pointer?
Legacy.
That argument had a different meaning before VBOs: you'd keep the vertex data in client memory and pass the address of the array (see glEnableClientState and such).
Now the last parameter can have 2 meanings (offset for buffer objects, address for client state arrays). Khronos did not provide a separate version for gl*Pointer
functions for buffer objects, so you need to do this awkward cast.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With