SFML community forums
Help => Graphics => Topic started by: Insentience on May 18, 2014, 09:03:59 pm
-
Disclaimer: I don't really know what I'm talking about
When I zoom my sf::View outwards, more sprites are drawn and subsequently the fps drops like an anvil. Is it possible for me to set my sprites to draw at a 'lower' level of detail, speeding up the process of drawing everything?
Thanks
EDIT: Would mipmapping be the only solution?
-
The limiting factor in performance is usually not the number of pixels being drawn, but the number of draw calls. So, using a lower LOD won't really help. It's a bit different in 3D where LOD determines the number of polygons.
What you can do is use sf::VertexArray instead of sf::Sprite to draw multiple entities at once.
-
Using a vertex array like this would require that all of the spirtes share a common texture, correct?
What if, by condensing everything into a single tile sheet, the texture ended up really really big? Wouldn't that be bad?
-
Yes. You can find a trade-off between texture size and number of draw calls. Even if you end up with a dozen vertex arrays, that's still nothing.
Out of curiosity: how many objects are visible at the same time? And you do manually exclude the invisible ones, don't you?
-
Yes. You can find a trade-off between texture size and number of draw calls. Even if you end up with a dozen vertex arrays, that's still nothing.
Out of curiosity: how many objects are visible at the same time? And you do manually exclude the invisible ones, don't you?
There isn't a set number of objects appearing on the screen at the same time. And of course I do, I'm using a quadtree
I'm not that clueless :P
-
There isn't a set number of objects appearing on the screen at the same time.
Okay, I only thought about the rough order of magnitude. If you have really many objects (millions or so), some kind of LOD might still be appropriate, but then I'd rather go in the direction of sf::RenderTexture. You would then save areas that don't change in a specific resolution and re-render them as one sprite.
-
Well, it's not in the millions. Thanks for the help
-
There isn't a set number of objects appearing on the screen at the same time.
Okay, I only thought about the rough order of magnitude. If you have really many objects (millions or so), some kind of LOD might still be appropriate, but then I'd rather go in the direction of sf::RenderTexture. You would then save areas that don't change in a specific resolution and re-render them as one sprite.
Great and very helpful answer also for me.