SFML community forums

Help => General => Topic started by: metafurionx on January 18, 2017, 05:57:50 am

Title: Rendering some Sprites once while re-rendering others
Post by: metafurionx 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?
Title: Re: Rendering some Sprites once while re-rendering others
Post by: Laurent on January 18, 2017, 07:18:59 am
http://www.sfml-dev.org/tutorials/2.4/graphics-draw.php#the-drawing-window

Especially the red box at the end of the section.
Title: Re: Rendering some Sprites once while re-rendering others
Post by: metafurionx on January 18, 2017, 12:51:22 pm
How unfortunate.
Title: Re: Rendering some Sprites once while re-rendering others
Post by: eXpl0it3r 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. :)
Title: Re: Rendering some Sprites once while re-rendering others
Post by: Laurent on January 18, 2017, 01:57:31 pm
What problem are you trying to solve by not re-drawing static sprites?