Hey guys, hopefully I am just misunderstanding how the Graphics class and drawQuads works but I was hoping for some feedback. During startup I create a large Sprite by calling the drawQuads method with my tile and transform arrays. This is great because it draws the large sprite at startup as I would expect. Then at some point in the future during a frame update I want to update just a tiny part of the sprite using drawQuads again but this time just with a single tile and transform in the area I want to update without calling clear. It actually works but as best I can tell there is a memory leak because drawQuads keeps pushing the commands. I am definitely a novice when it comes to HW graphics rendering but I dug around in the DrawCommandBuffer class and don’t see a way to issue a single drawQuads command and not clear. Thoughts?
drawQuads command is stored in a buffer so adding more
drawQuads commands will continue to increase the number of draw calls required. Perhaps you could cache your first
drawQuads data and re-use it when you need to make further changes?
graphics.clear(); graphics.drawQuads(...); // re-do the initial sprite graphics.drawQuads(...); // add the extra sprites on top
You might even be able to reconstruct your whole
drawQuads call each frame… it might not be as expensive as you think.
Another way to handle this would be to use
Tilemap and let it do the rendering for you