Open lejar opened 4 years ago
Hey!
I would be fine if would be behind a define and documented, so its available in case you need it. Do you, by any chance, had the possibility to measure the performance loss? Is it actually much slower?
There definitely is a performance loss, but I don't know if I'd call it a large one. I made a test with 200 LUIButtons, plus a variable number of LUISprites. I unlocked the frame rate and took some measurements with each number of LUISprites, then calculated the frame time from the fps and plotted it.
Github wouldn't upload my graph, so I had to put it here.
Since the whole UI is drawn in one call, there is a limit on the number of textures you can have at once. I needed to have a much higher limit, so I hacked in separate draw calls for each LUISprite object, which lets you have as many different sprites with different textures as you want.
This was done by passing a vector down into render_recursive, and letting each object decide whether or not they want to put in a geometry and shader attribute object. This way, only the LUISprites get an extra draw call.
@tobspr If you think something like this is okay, I can clean it up and hide the functionality behind a define, then make a pull request. My commit is https://github.com/tobspr/LUI/commit/264434dde1a0320013040e8208a27b72035f76e1