1
\$\begingroup\$

I have a TextureRegion that I get from an atlas map (which in turn I get from the Asset Manager), eg

AssetManager am = myGame.getAssetManager();
TextureAtlas atlas = am.get("my.atlas", TextureAtlas.class);
TextureRegion object = atlas.findRegion("myobject");

Now when I draw the object with

batch.draw(object, ...);

the object is drawn correctly, but if I do

batch.draw(object.getTexture(), ...);

it is drawn as garbage. Is this expected? I thought it should work the same.

\$\endgroup\$
1
\$\begingroup\$

Ok, problem solved. Trying with bigger objects from the same texture atlas, I see that getTexture() actually returns the whole atlas image, and this is by design, see eg this question

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.