SFML community forums

Help => Graphics => Topic started by: xqbt on June 27, 2016, 08:22:19 pm

Title: Efficiency question: Sprite vs Text
Post by: xqbt on June 27, 2016, 08:22:19 pm
So, I need to draw a lot of text on the screen - an array of sf::Text objects. This text is not going to change very often. So, I thought, why not draw all these sf::Text objects on sf::RenderTexture object and then, when the text updates, just redraw the texture? Will drawing the sf::RenderTexture through a sprite in the main window be more efficient than drawing the text in the same window?
What I think is maybe drawing text is more expensive than drawing it once on a texture and then just drawing the texture.
Title: Re: Efficiency question: Sprite vs Text
Post by: Laurent on June 27, 2016, 08:49:38 pm
It depends. Since both options are pretty easy to implement, you should just try.
Title: Re: Efficiency question: Sprite vs Text
Post by: xqbt on June 27, 2016, 10:59:59 pm
Laurent, thanks for advice. I ran some tests, for anyone interested, here are the results.
1)
.
2)
.
Well, the slowness of the second case with texture can be explained by the size of this texture - 800 * 800.
Anyway, bottom line: predrawing non-overlapping text is faster with plain text objects.