SFML community forums

Help => Graphics => Topic started by: tbop on June 28, 2013, 03:36:58 pm

Title: Bug? RenderTexture cannot work without a previous RenderWindow call
Post by: tbop on June 28, 2013, 03:36:58 pm
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!
Title: Re: Bug? RenderTexture cannot work without a previous RenderWindow call
Post by: victorlevasseur 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
Title: Re: Bug? RenderTexture cannot work without a previous RenderWindow call
Post by: Laurent 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?
Title: Re: Bug? RenderTexture cannot work without a previous RenderWindow call
Post by: tbop 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.