2D Texture region memory usage

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DodoIta

Hello!
When you’re using a spritesheet and you set the correct sprite using the Sprite/region property, does that mean that for every sprite you’re allocating memory for the whole image or just for the selected region?
And if it is the first one, does that imply a consiberable performance overhead or is it negligible?

:bust_in_silhouette: Reply From: Zylann

The texture is loaded only once, and all following sprites using it will just reference the same one. Then the sprite will be drawn using only the selected region, which is a very fast operation for the renderer.

Goi it, thank you.

DodoIta | 2018-04-05 13:16