I have a little problem kind of question. I was using glDrawElements to render a lot of lines as triangle strips however I have merged all the strips and used a color pointer in order to do just one call to glDrawElements.
However I “hit” with a limit of 16 bits GL_UNSIGNED_SHORT as the indices for glDrawElements so 65536 the limit to vertice indice.
My value is almost twice the limit, because I have a lot of lines, so I have to changed to glDrawArrays with vertices in strips in order to render all the lines.
My question is simple, was my choice a good solution, or glDrawArrays is not so slow ?
If I have to use glDrawElements and will have to do several calls instead of only one with glDrawArrays.
If you definitely need to render this many vertices and you’re getting a speed of render that you’re happy with then I’d say this may be a good choice.
Another solution would be to break up your VBOs into smaller numbers of vertices so that the indices can still fit into 16-bit values. Arbitrarily breaking up the vertices may add very few draw calls this way, but still reduce the amount of vertex data put through the system compared to using arrays. If you only have a small number of colours then batching by colour may save you bandwidth that makes up for the extra draw call overhead. There may also be another logical choice to split up the vertices by state in the code.
The best way to tackle this may also depend on your target platform.