O'Reilly logo

LibGDX Game Development Essentials by Juwal Bose

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

Displaying the graphics

Texture is how an image is uploaded to the Graphics Processing Unit (GPU), which is later used by the OpenGL context to draw onto the screen. Usually textures are drawn mapped to a rectangular geometry. Texture drawing is an expensive process and any trick that can help make this faster should be employed. This is where the SpriteBatch class comes in.

The SpriteBatch class can make texture drawing more efficient by collecting all the positions where a specific texture is to be drawn and drawing it in one pass. It batches geometry that we want to send to the GPU to draw. This is effective when the same texture is being drawn at multiple positions. But if the texture changes then it becomes ineffective. The solution is to ...

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