I have to freely admit that this may not be a good idea from an implementor’s point of view, but for using GL to create UI’s it would be heck-a-nice:
Rather than using a common index stream for all vertex attributes, have the ability to have a separate index stream for each attribute, something like this kind of API:
glVertexAttribPointer --> sets vertex attribute pointer as before
glVertexIndexPointer --> sets the index array
glDrawPerAttribIndexElement(GLenum type [i.e GL_TRIANGLES, etc], first, count);
for example:
for(int i=0, i<number_attributes_to_use; ++i)
{
glVertexAttribPointer(i, number_components[i], attribute_values_type[i], attribute_values_normalized[i], attribute_values_stride[i], attribute_values_pointer[i]);
glVertexIndexPointer(i, attribute_index_type[i], attribute_index_stride[i], attribute_index_pointer[i]);
}
glDrawPerAttribIndexElement(GL_TRIANGLES, 0, number_points);
is equivalent to:
glBegin(GL_TRIANGLES);
for(int v=0; v<number_points; ++v)
{
for(int i=number_attributes_to_use-1; i>=0; --i)
{
int I;
I=attribute_index_pointer[i][v];
glVertexAttribute[??](i, attribute_values_pointer[i][i] );
}
}
glEnd();
where [??] corresponds the correct suffix for the type and number of elements.
Edit: emulating this behavior is possible by using texture buffer objects and having the attributes be the index and having the vertex shader fetch from the texture buffer objects, also one can do this via GL_NV_shader_buffer_load, but I’d imagine both carry an unnecessary overhead if it can be done more directly.
2nd Edit: Additionally, the suggestion naturally would have a methodology for using buffer objects of the index stream [likely glVertexIndexPointer would use a vertex buffer object if something is bound to GL_INDEX_ARRAY_BUFFER]. Additionally, logical working with the instancing glDraw calls too.