Important: Please read the Qt Code of Conduct -

Do I need a texture atlas

  • Hi,

    I made a few kids Android games using libgdx. They were all pretty simple - matching letter tiles to pictures, etc.

    It seems Qt Quick is ideal for this sort of thing and being cross-platform is a massive bonus (I know, libgdx is too but I do like to tinker).

    What I'm struggling with is how to bundle my graphics together and load/unload them to reduce texture switching/binding.

    Does anyone know how I should go about this? I'm sure it can't be too complex as Sprite comes very close. It seems to expect all images to be the same height/width for animations though.

    Sorry for the poor description. Perhaps if I could describe it better I'd have been more successful with my googling.


  • If you use the Image element in QML, all smallish textures will go into the internal texture atlas and they can all be batched together and performance will be good.

    Sprite is currently not a good candidate as it generates a unique texture id for each spriteset so they don't allow batching.

    See for more details.

  • sletta, thanks for the answer and useful link. I should really have known that Qt would make it easy for me.

    Does the scene graph load and unload textures from the atlas as they are needed?

    E.g. I have a mobile game. A level in the game consists of a number of questions. So I'd have a few image components on screen being rendered, the question is answered, those components are disposed of (or the image source changed) and some new ones created and rendered.

  • The images are unloaded from the atlas when they are no longer in use, basically when nobody references the Image element anymore + some time passes by.

  • Great, thanks for the info sletta.

    Qt really does make simple games easy to develop.

Log in to reply