Java – is it better for libgdx to use spritesheet or a single image?
I'm new to libgdx. I made 40 frames for the "hero run" wizard. I don't know if it's better to use spritesheet or a single image The spritesheet is very large because I want high weight even on the 1080p device Can you tell me which situation (springsheet or personal picture) will perform better?
Solution
Since the other answers here do not point in the wrong direction, but are not 100% accurate, I will add a more detailed explanation
In the case of animation, it should not make a difference in performance!
Whether you use a spritesheet or a single image, they will only be sent to the GPU once The only difference from sprite sheets is that you only need to bind the texture once and don't force it to change when rendering different things
But this doesn't apply to your hero animation Whether using a springsheet or a single image, you need to bind the texture again in each frame, and only draw a part of it (in the case of a springsheet) or the whole image (in the case of a single image), because in two frames, you also render other non hero things
This is an exception if you draw several heroes in a frame With a single image, you must switch textures every time, because heroes may not be synchronized In the case of spritesheet, you bind the texture only once, and then paint all heroes with sheet texture once (in this case, texture binding only occurs once)
However, if you use character animation springsheet as part of another "bigger" springsheet, you will certainly get performance improvement, including other textures In this way, you can paint characters and other things again with only one texture binding
The only problem with Sprite sheets is that they tend to waste some space Especially on mobile devices, this may be different when you are forced to use pot (2 powers) size textures