In OpenGL, why does glVertexAttribPointer require the “pointer” argument to be passed in as void*?

后端 未结 2 1188
误落风尘
误落风尘 2021-02-09 12:53

The specification for the glVertexAttribPointer is as follows:

void glVertexAttribPointer( GLuint index,
    GLint size,
    GLenum type,
    GLbool         


        
2条回答
  •  攒了一身酷
    2021-02-09 13:41

    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.

提交回复
热议问题