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

Author Topic: Add a RenderTarget::setActive() virtual method  (Read 2767 times)

0 Members and 1 Guest are viewing this topic.

DoYouRockBaby

  • Newbie
  • *
  • Posts: 3
    • View Profile
Add a RenderTarget::setActive() virtual method
« on: May 11, 2013, 12:57:27 am »
Hello World !

First sorry for my poor english.

I think it is problably a forgotten made by the developpers but the setActive() method is implanted in RenderWindow and RenderTexture but not in RenderTarget as virtual function, it is a little bit problematic for me because i try to make my render class that render OpenGL scene able to render to Window or Texture without any change in the code. (and moreover, i think it is logic to make that method virtual).

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: Add a RenderTarget::setActive() virtual method
« Reply #1 on: May 11, 2013, 01:04:19 am »
I think that is a design decision rather than something that was forgotten. This is because the render texture doesn't always use the same technique and therefore that approach wouldn't work with all of them.

So, Laurent decided to implement the API as it is now, to make sure the code remains portable. Correct me if i am wrong! :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Add a RenderTarget::setActive() virtual method
« Reply #2 on: May 11, 2013, 08:42:03 am »
The RenderTarget base class was added to refector common code, not to provide an abstract interface that could be used polymorphically. Therefore it only contains what's required to make the derived classes work.

The problem is that some function of sf::RenderWindow are inherited from sf::Window, they are part of another hierarchy. I'm not saying that this is a problem that can't be solved, but it's a little more complicated than just putting a 'virtual' keyword in front a the setActive function.
Laurent Gomila - SFML developer

DoYouRockBaby

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Add a RenderTarget::setActive() virtual method
« Reply #3 on: May 12, 2013, 02:52:48 pm »
Oh yes you're right, i didn't see that setActive() was a part of sf::Window class, sorry for the disarrangement.

 

anything