Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Sprite batching?  (Read 1470 times)

0 Members and 1 Guest are viewing this topic.

ILostMyAccount

  • Newbie
  • *
  • Posts: 22
    • View Profile
Sprite batching?
« on: February 17, 2015, 11:11:58 am »
Can someone explain me what exactly is the sprite batching?
And can you link me an example of code in SFML?

Thank you.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: Sprite batching?
« Reply #1 on: February 17, 2015, 11:32:43 am »
How about you use the search function to find it yourself?
Because that's exactly what I now have to do, just so you don't have to do it....
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

InverseSec

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Sprite batching?
« Reply #2 on: February 20, 2015, 10:00:42 pm »
I'd like an answer for this too. I assumed that having a single spritesheet with all the sprites for different objects would be fine, and I could just draw each thing individually, and since it uses the same spritesheet (albeit with different coordinates for the intrect), it would be fine.
Apparently that's not the case.

Also, I used the search function and could not find another topic for this.

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: Sprite batching?
« Reply #3 on: February 20, 2015, 10:47:29 pm »
In short: Sprite Batching is a way to draw lots of things all in one draw call. All those things must come from the same texture.

Here's how I came up with my own way to do sprite batching:
https://github.com/dabbertorres/SwiftSpriteBatch

It uses a sf::VertexArray to draw everything.