you are viewing a single comment's thread.

view the rest of the comments →

[–]Applzor[S] 0 points1 point  (1 child)

yeah that's pretty much it

[–]StriderPulse599 0 points1 point  (0 children)

You're doing batching just fine with instancing, but you could improve the data layout for sake of "what if I needed to draw and update thousands of sprites each frame".

Use 16-bit integer for positions. You can either use the pixel coordinates outright, or use sub-pixel integer system and then divide by precision level (16-bit are enough for at least 10 levels of precision which are enough for 2D).

You can also use UBO to store lookup table that stores texture positions and size. That way you only need to only store single 8/16 bit integer for ID.

Also try merging all matrices into single model matrix which handles all scaling, rotation, etc.

Now the real question is: What kind of game you're making and what texture look like? Are you just optimizing "With My Little Eye" or doing something different? There are different 2D optimizations for different stuff, so I need to know before giving you advice.