So the buffer is new Float32Array(1000);, it actually takes 1000 floats.
But since it's used to provide a vec2, an x,y vector, then it supports 500 sprites.
The "500" is just a random number. The demo will fail if you try to add more than 500 images. If you wanted to support any number of sprites, you'd have to create a new, larger array when the original ran out of space.
So the buffer is
new Float32Array(1000);
, it actually takes 1000 floats.But since it's used to provide a
vec2
, an x,y vector, then it supports 500 sprites.The "500" is just a random number. The demo will fail if you try to add more than 500 images. If you wanted to support any number of sprites, you'd have to create a new, larger array when the original ran out of space.
Also, thanks, I'm glad you enjoyed the article!
Understood. Thank you this explanation.