PDA

View Full Version : glDrawElements



Chris_F
03-11-2014, 04:06 AM
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 (https://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml): "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?

nenad*
03-11-2014, 05:00 AM
If indices are in the video ram buffer the pointer parameter is interpreted as a byte offset from the index array start

Osbios
03-11-2014, 05:13 AM
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.

Chris_F
03-11-2014, 06:43 PM
Vertex Buffers are the default mode of operation, where the pointer points to system memory.

Not in core profile it isn't.

Osbios
03-11-2014, 09:30 PM
Not in core profile it isn't.

With that definition glBegin also has a different default behaviour in core profile. ;)

Chris_F
03-11-2014, 11:21 PM
With that definition glBegin also has a different default behaviour in core profile. ;)

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."