I am reading the article "Particles / Instancing"
Here is the quote:
Clearly, we need a way to draw all particles at the same time.
There are many ways to do this; here are three of them :
(a) Generate a single VBO with all the particles in them. Easy, effective, works on all platforms.
(b) Use geometry shaders. Not in the scope of this tutorial, mostly because 50% of the computers don’t support this.
(c) Use instancing. Not available on ALL computers, but a vast majority of them.
Yes, (a) is implemented at the same time.
For (c), I thought glDrawArraysInstanced is equal to a loop of glDrawArrays. Is it real same-time implementation?
For (b), I think we could use vertex to have the same effect.
For instancing,
glDrawArraysInstanced
has the same visual effect as callingglDrawArrays
multiple times, however, if your driver has support for true instancing (which almost all desktop GPU drivers will, and many mobiles), then it will perform significantly better. The savings, is due to less data transfer between CPU and GPU, and fewer GL API calls.These days, geometry shaders are also on the vast majority of desktop GPU drivers - the article is a few years old. Mobile adoption is slower, as it is not a core feature of GLES 3.0. Generally, particles are billboard quads (4 vertices), but the vertices can be generated via a geometry shader with a single point, and some meta-data, instead of putting all 4 vertices into a VBO. This just reduces the size of the data transfer from CPU to GPU.