This is a follow up post regarding those doubts I had yesterday. I could only solve 2 (two) of them, but I just feel like writing what I found out down. Let's begin with the simplest doubt:

1. why do the textures act all weird

This was actually really simple to solve. The problem was that I hadn't binded the rock (asteroid) texture, so OpenGL was trying to use the texture that was already loaded at position 0, i.e. the planet texture. To solve this, I just had to bind the rock texture before drawing the asteroid.

2. the math that randomizes the position, size and rotation of the asteroids

The thing is, I am teaching programming myself, and since nobody told me how to get a random number that belongs to an interval, and I hadn't needed to use that before, it is only natural that the calculation to get a random displacement number for the asteroids (displacement = (rand() % (int)(2*offset*100)) / 100.0f - offset) would confuse me.

It turns out that if you want to get a random number which belongs to the interval (min_number; max_number), you can use r = (rand() % max_number) + min_number. In this case, we want to get a displacement value that belongs to (-offset; offset). Which would result in displacement = (rand() % offset) - offset. Since +(-offset) is the same as -offset, we can just skip that + sign.

The division and multiplications are necessary to prevent the asteroids from being so tightly packed together.

Now the only thing left is to understand glVertexAttribDivisor(), wish me luck :P