I am currently writing a program that displays point clouds. They are not that big, so I store all the vertices in one vao. The problem is that I have to only draw certain vertex ranges (for example from 0 to 15, 18 to 2000, 2000 to 2050 etc.).
That means however, that I am doing a lot of draw calls every frame, and it impacts performance a lot compared to just drawing every vertex in one glDrawArrays call. Is there a way to optimize this?
…Does it? Do you have some profiling data showing that?
OpenGL is quite fast if you’re making multiple consecutive draw calls with no state changes between them. The problem of draw calls is generally only relevant if you’re changing some state between them.
You could use indexed rendering, but you’d have to build an index buffer per-frame. You could use multi-draw indirect rendering, but you’d have to build indirect buffers per-frame; they’d be smaller than indices of course, but you’d still be building them.
It works now (good old change nothing, and then it works ).