Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use an OrthogonalTiledMapRenderer:

renderer = new OrthogonalTiledMapRenderer(world.getMap());

and I wonder if there is a differnce between this call:

renderer.getSpriteBatch().draw(sprite, sprite.getX(), sprite.getY());

and this:


If there is a difference, what is it?

share|improve this question
While there's no difference between the two, I do want to point out something for future reference: OrthogonalTiledMapRenderers have a SpriteBatch in the class, meaning that if you have a SpriteBatch to render everything and then you create a OrthogonalTiledMapRenderer to render your map, you'll come up with some pretty random rendering bugs. An easy fix is to instantiate the OrthogonalTiledMapRenderer like so: OrthogonalTiledMapRenderer mapRenderer = new OrthogonalTiledMapRenderer(map, alreadyExistingSpriteBatch); – hasherr Aug 11 '14 at 16:47
Sprite is a subclass of TextureRegion. I found this helpful when thinking about drawing Sprites. – Brandon Aug 12 '14 at 20:23

I found this in the libGDX source code, in class

public void draw (Batch batch) {
    batch.draw(texture, getVertices(), 0, SPRITE_SIZE);

So no, no difference. It shows Sprite.draw is only syntactic sugar for the longer version you posted.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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