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 ...
Get LibGDX Game Development By Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.