SFML community forums

Help => Graphics => Topic started by: RaptorIV on November 04, 2011, 08:16:55 pm

Title: RenderWindow.Clear() one sf::Shape?
Post by: RaptorIV on November 04, 2011, 08:16:55 pm
Is it possible to remove a single DrawableObject from the render window rather than clear the whole thing every time? Seems inefficient in larger applications
Title: RenderWindow.Clear() one sf::Shape?
Post by: Laurent on November 04, 2011, 08:19:46 pm
Nop. This is how things work, don't worry about that.
Title: RenderWindow.Clear() one sf::Shape?
Post by: RaptorIV on November 08, 2011, 11:33:50 pm
So redrawing the whole frame is not taxing? Sorry, the scholar inside me dislikes the response "don't worry about that"
Title: RenderWindow.Clear() one sf::Shape?
Post by: Haikarainen on November 09, 2011, 12:45:34 am
Quote from: "RaptorIV"
So redrawing the whole frame is not taxing? Sorry, the scholar inside me dislikes the response "don't worry about that"


Instead of changing the methods sfml draw the window, learn to manage the methods your project uses to draw a window. Could be as simple as  If(DrawPlayer)(Window.Draw(Player));
Title: RenderWindow.Clear() one sf::Shape?
Post by: Tex Killer on November 09, 2011, 12:56:00 am
The thing is: The rendered image is not layered, so if something is printed in front of another thing, that another thing gets replaced on those pixels. There is no coming back, as there is no changing history nor layers.

The best you can do is redraw only what was behind the removed image, but if there was something on top of it, will get replaced as well. And so on.

The simplier and more doable thing is to redraw everyting each frame, which is not very costly for something like 60 FPS, depending on the number of drawable instances. Everyone does just that.
Title: RenderWindow.Clear() one sf::Shape?
Post by: RaptorIV on November 09, 2011, 09:49:04 pm
Quote from: "Tex Killer"
The thing is: The rendered image is not layered, so if something is printed in front of another thing, that another thing gets replaced on those pixels. There is no coming back, as there is no changing history nor layers.

The best you can do is redraw only what was behind the removed image, but if there was something on top of it, will get replaced as well. And so on.

The simplier and more doable thing is to redraw everyting each frame, which is not very costly for something like 60 FPS, depending on the number of drawable instances. Everyone does just that.


ahh thank you