glDrawElements

Given the function:


void glDrawElements(GLenum mode,  GLsizei count,  GLenum type,  const GLvoid * indices);

I find myself confused about what the pointer indicies is used for. According to khronos: “Specifies a pointer to the location where the indices are stored.”

Indices are stored in GPU memory using a GL_ELEMENT_ARRAY_BUFFER. Is this indices pointer just a holdover from legacy GL where vertex attributes and indices were stored in client-side memory? Does it have any use still in core profile GL?

If indices are in the video ram buffer the pointer parameter is interpreted as a byte offset from the index array start

glDrawElements and other commands can work on Vertex Buffers (Always system memory) and Vertex Buffer Objects (Can be in vram).
Vertex Buffers are the default mode of operation, where the pointer points to system memory.
If you bind an VBO, then the pointer will point to the VBO memory space.

Not in core profile it isn’t.

With that definition glBegin also has a different default behaviour in core profile. :wink:

I like to pretend that those functions simply don’t exist. To quote Ian Romanick from Intel, “it [compatibility profile] should die in a fire anyway.”