"We're no longer using a model uniform variable, but instead declare a mat4 as a vertex attribute so we can store an instanced array of transformation matrices." I am amazed that I was able to understand this sentence.

Today I advanced on the Instancing part of THE OpenGL tutorial and you can see the results in pic related (open as img to see full size). You see, making a lot of draw calls clogs the CPU to GPU bus, and thus, slows down the rendering process because even if your GPU can execute each draw call easily, they will take a lot longer to actually get to the GPU. This means that you'll want to make (or do?) as few draw calls as possible.

"But mm4rk3t", you say, "what if I want to render ten thousand rocks?, wouldn't that be impossible? how do other people manage to do it?" Fear not, because I'll tell you.

In short, instead of doing ten thousand normal draw calls, you only make one instanced draw call that is going to take advantage of the data that is alreay in the GPU's memory, in order to draw the vertices. This way you only have to append model matrices as vertex attributes to the model's vertex array and modify the vertex shader so that it uses that to render the vertices.

However, in this chapter there are three things I still don't understand:

  • the math that randomizes the position, size and rotation of the asteroids
  • the "glVertexAttribDivisor()" function
  • why do the textures act all weird

I'll try to look more into that before advancing to the Anti Aliasing section, but I don't know whether I'll be able to hold off, kek.