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

Author Topic: Bug? RenderTexture cannot work without a previous RenderWindow call  (Read 1549 times)

0 Members and 1 Guest are viewing this topic.

tbop

  • Newbie
  • *
  • Posts: 34
    • View Profile
Hi,


I was trying to use a RenderTexture as a drawing utility method and then binding the texture on a concurrent OpenGL context I'm getting from my application. It was working... until I got rid of a former RenderWindow attribute I was using previously in this class (but no longer using in the code itself).

To my surprise, all of a sudden the program stopped working and the texture was no longer rendered in my OpenGL context.
I've reverted and I've investigated on it.
It turns out that for some reasons there's a global initialization process which is called in sf::Window once and as long as this hasn't been triggered the rest won't just work.

So although I'm not using it I've got an object sf::RenderWindow in my class that ensures this global initialization is done once.

Am I right, and if yes is this intended?
Is there any workaround to work with RenderTexture objects in SFML without having to instantiate a sf::RenderWindow once at least?


Cheers all!
« Last Edit: June 28, 2013, 03:38:42 pm by tbop »

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Bug? RenderTexture cannot work without a previous RenderWindow call
« Reply #1 on: June 28, 2013, 03:52:13 pm »
Hello,

Maybe this class will resolve your problem :
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Context.php

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bug? RenderTexture cannot work without a previous RenderWindow call
« Reply #2 on: June 28, 2013, 04:03:33 pm »
There is indeed a global init in SFML, but it shouldn't cause you any problem, it is triggered whenever it is needed.

Could you write a complete and minimal example that reproduces the problem?
Laurent Gomila - SFML developer

tbop

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Bug? RenderTexture cannot work without a previous RenderWindow call
« Reply #3 on: June 28, 2013, 04:51:59 pm »
Indeed you're right I've reverted that again and it didn't do anything wrong.
I might have just hallucinated again and it was due to something else I hadn't noticed at that time I guess. Topic close.

 

anything