O'Reilly logo

LibGDX Game Development By Example by James Cook

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Packing textures

Currently, we have our textures as individual files. For a game the size of Flappee Bee, that would normally be OK, since during the game we have four files. However, what would happen if we started adding more and more in-game textures? Eventually, we would start slowing down the game. The reason for this is that the underlying OpenGL is performing something called a bind for every different texture it renders. Binding is relatively expensive. To combat this, we can combine our assets into a single sheet, ah! You might be thinking, "But now I have to know where in the sheet the image is?", "What pixels to cut out?", and "What if they are rotated or white-space trimmed to save space in the image?" Well, fear not; LibGDX has a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required