gl.drawArrays()
for (int i = 0; i < count; ++i) {
gl_VertexID = i;
vertexShader();
}
Behinds the scenes, or really, inside of the GPU, the system is iterating over the requested number of vertices, updating the vertex ID, and then requesting that the vertex shader be executed. This is a very simplistic representation of what is happening, as GPUs execute lots of operations in simultaneously. What’s important to know is that even if things are occurring in parallel, each vertex shader receives a unique vertex ID, which we can use to make computational decisions.