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

Author Topic: RenderWindow.Clear() one sf::Shape?  (Read 3463 times)

0 Members and 1 Guest are viewing this topic.

RaptorIV

  • Newbie
  • *
  • Posts: 30
    • View Profile
RenderWindow.Clear() one sf::Shape?
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
RenderWindow.Clear() one sf::Shape?
« Reply #1 on: November 04, 2011, 08:19:46 pm »
Nop. This is how things work, don't worry about that.
Laurent Gomila - SFML developer

RaptorIV

  • Newbie
  • *
  • Posts: 30
    • View Profile
RenderWindow.Clear() one sf::Shape?
« Reply #2 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"

Haikarainen

  • Guest
RenderWindow.Clear() one sf::Shape?
« Reply #3 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));

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
RenderWindow.Clear() one sf::Shape?
« Reply #4 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.

RaptorIV

  • Newbie
  • *
  • Posts: 30
    • View Profile
RenderWindow.Clear() one sf::Shape?
« Reply #5 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

 

anything