Closed LedLoaf closed 7 months ago
It's not sprite batching since each sprite still gets drawn separately. So, if there are 10 instances of the asteroid it will set the uWorldTransform
uniform and texture per each instance and issue a separate glDrawElements
.
One way to do sprite batching in OpenGL is that instead of having a single world transform matrix in the uniform you instead have an array of the world transform matrices, each index corresponding to an instance, and then you can use glDrawElementsInstanced
to draw the instances.
Hey! Thanks for the response. That seems easy enough, I'll give it a shot.
Thanks
I had a question regarding the 2D example using OpenGL.
Because the draw components happen all at once as it loops through the sprite components, is this considered sprite batching? Or do I still need to find a way to implement that so it all happens at one draw call? If so, any ideas using the same structure as this code?
Thanks