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

Author Topic: Rendering some Sprites once while re-rendering others  (Read 1158 times)

0 Members and 1 Guest are viewing this topic.

metafurionx

  • Newbie
  • *
  • Posts: 13
    • View Profile
Rendering some Sprites once while re-rendering others
« on: January 18, 2017, 05:57:50 am »
My program maps and draws a huge grid of sf::Sprites for the background. Some of them are just static and some are animated. I want to draw the static ones only once and then keep redrawing only the animated ones.
However, sf::RenderWindow.clear() wipes the whole window.
How can I separate both processes so I don't touch the static ones?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Rendering some Sprites once while re-rendering others
« Reply #1 on: January 18, 2017, 07:18:59 am »
Laurent Gomila - SFML developer

metafurionx

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Rendering some Sprites once while re-rendering others
« Reply #2 on: January 18, 2017, 12:51:22 pm »
How unfortunate.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Rendering some Sprites once while re-rendering others
« Reply #3 on: January 18, 2017, 01:43:54 pm »
If you run into performance issues, you can always use a vertex array to reduce the number of draw calls. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Rendering some Sprites once while re-rendering others
« Reply #4 on: January 18, 2017, 01:57:31 pm »
What problem are you trying to solve by not re-drawing static sprites?
Laurent Gomila - SFML developer