SFML community forums

Help => Graphics => Topic started by: Bizarreofnature on October 20, 2017, 09:49:35 pm

Title: Get current screen (image)
Post by: Bizarreofnature on October 20, 2017, 09:49:35 pm
Hello there!

I got a small problem. I want the current screen contents to load into a texture.

TextureWindow.update (gWindow);
Window.setTexture (TextureWindow);

gWindow is my renderwindow and Texturewindow an sf::texture, Window an sf:sprite.

Somewhy it does not work. The Window sprite is empty.

Please help me.

Best regards
Bizarreofnature
Title: Re: Get current screen (image)
Post by: eXpl0it3r on October 20, 2017, 10:37:05 pm
Have you read the paragraph about The white square problem (https://www.sfml-dev.org/tutorials/2.4/graphics-sprite.php#the-white-square-problem)?
Title: Re: Get current screen (image)
Post by: Bizarreofnature on October 20, 2017, 11:04:16 pm
Cant be it. I store my sf::texture as a private member var in a class.
(aswell as my sf::sprite)
Title: Re: Get current screen (image)
Post by: Bizarreofnature on October 20, 2017, 11:15:17 pm
The texture and sprite itself work both. If i load a normal file it works fine. Its just this .update which isnt working.
Title: Re: Get current screen (image)
Post by: Laurent on October 20, 2017, 11:29:32 pm
Is the texture created with the correct size before the call to update?
Title: Re: Get current screen (image)
Post by: Bizarreofnature on October 20, 2017, 11:31:40 pm
Thank you very much! Works like a charm  :)