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

Author Topic: sf::RenderTarget and display()  (Read 2855 times)

0 Members and 1 Guest are viewing this topic.

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
sf::RenderTarget and display()
« on: January 01, 2013, 04:34:15 pm »
Just a small confusing thing that I noticed, but why is 'display()' not a pure virtual function
of sf::RenderTarget? It has the same signature in both RenderTexture and RenderWindow o.o

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::RenderTarget and display()
« Reply #1 on: January 01, 2013, 08:45:39 pm »
Because it's a virtual function of sf::Window.

In fact, RenderTexture::display() has the same name as RenderWindow::display() because the usage is similar, but:
- it's not required at RenderTarget level
- internally it does a totally different thing
Laurent Gomila - SFML developer

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: sf::RenderTarget and display()
« Reply #2 on: January 01, 2013, 08:54:51 pm »
Ah, I see, thanks.
Yeah, you're right, as far as I can tell RenderWindow::display() flips buffers,
whereas the single-buffered RenderTexture just corrects the Y-axis.

The reason I asked was because I needed a "finalize draw" method that works from RenderTarget,
but it's trivial to do that myself ^^