I've searched around for tutorials. I've seen people using the above classes to load images.

As according to my understanding, all of the classes can read in a non-power of two images, TextureRegion/TextureAtlas are usually used to load sprite sheet, in which the sheet contains multiple images. While for Texture/Sprite/Image, they are used to load a sprite sheet with single image.

However, I'm not so sure in which situation I should use Texture/Sprite/Image and in which situation I should use TextureRegion/TextureAtals.

Please correct me if I'm wrong, as I'm a bit confused by the terminologies in the API after looking various tutorials.


1 Answer 1


First, Texture vs TextureRegion: When you do something like Texture t = new Texture(path), you are loading that into GPU. In addition, you should load power of 2 textures. You could work with other resolutions (Texture.setEnforcePotImages = false), but it's encouraged to use pow of 2.

Now, TextureRegion, takes a "piece" from a Texture, no matter it's dimension. The advantage of having one Texture and multiple TextureRegion of that Texture, is that you are NOT loading every region into GPU.

As you may be thinking, when you want to draw with the SpriteBatch, it's much more efficient to use TextureRegion instead of multiple Textures, I'm sorry my english is not good enough. Here is a good explanation: Textures TextureRegion & SpriteBatch

Now, you want to use TextureRegion and one single image in power of 2 resolution with all the spritesheets and images. Do you have to create TextureRegions with all the coordinates and dimensions? Do you need to open paint to count pixels? Noooo, you don't. You can use something like TexturePacker. It will pack every texture into one image AND create a .pack file with de dimensions and coordinates of all of them.


The result will be something like this:


Instead of creating a Texture, create a TextureAtlas, like this:

Create TextureAtlas

Now, creating your TextureRegions would be as simple as:


(Note that the name of the region is the name of the original image without the extension).

Sprite holds the geometry, color, and texture information for drawing 2D sprites using Batch. This mean, you can easily rotate them and move. I've created my own Entity class, and I don't need Sprite class. You would probably do the same. I don't find this class really usefull.

Image class inherits from Actor. This mean you can add it into a stage. It's part of the Scene2D package. If your are new to libgdx, and you don't know about this package, this is enough information for you about this class. It's a really interesting topic, but not to answer in this question.

Hope it helps :)

  • \$\begingroup\$ Thanks! That's clearer now. :) Then what about the performance of creating TextureRegion from Texture and creating TextureRegion from TextureAtlas? \$\endgroup\$
    – user15783
    Commented Dec 1, 2013 at 14:33
  • 5
    \$\begingroup\$ @user15783 Ask as a new question. \$\endgroup\$ Commented Dec 1, 2013 at 15:45
  • \$\begingroup\$ Lots of good information, but this part is inaccurate/misleading: "you are NOT loading every region into GPU" In fact, you are loading every region into the GPU. It's just that multiple TextureRegions can reference distinct (or overlapping) portions of a texture, while Texture always refers to the entire image. Since switching textures is expensive, this is good. Your description makes it sound like TextureRegion deals with sparse-textures (a la. GL_ARB_sparse_texture) but libGDX and most of the hardware it runs on doesn't support that extension. \$\endgroup\$
    – bcrist
    Commented Mar 5, 2015 at 4:33
  • \$\begingroup\$ Also, please prefer SE's markdown code blocks over screenshots of code. That way it's easy to copy and paste things if people want to. Just start each line of the code block with four spaces. Inline code spans can be created by surrounding text with the grave accent (backtick) character: ` \$\endgroup\$
    – bcrist
    Commented Mar 5, 2015 at 4:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .