SFML community forums

Help => Graphics => Topic started by: soaup on January 09, 2016, 01:28:19 pm

Title: problems with copying renderTextures
Post by: soaup on January 09, 2016, 01:28:19 pm
Hello and sorry for bad english! I had tried implement multiple shaders as described herein (http://en.sfml-dev.org/forums/index.php?topic=4799.0), but use RenderTexture. And it is not copied.

how i tried:
Quote
foreach (sf::Shader *shader, globalShaders) {
        front.clear();
        sf::Sprite sprite(back.getTexture());
        front.draw(sprite, shader);
        front.display();

        sf::RenderTexture temp = front;
        front = back;
        back = temp;
    }
And this error
Quote
C:\SFML\include\SFML\System\NonCopyable.hpp:67: error: 'sf::NonCopyable::NonCopyable(const sf::NonCopyable&)' is private
     NonCopyable(const NonCopyable&);
     ^
the problem disappears if you comment out the line
Quote
//sf::RenderTexture temp = front;
        //front = back;
        //back = temp;
Please answer - what is the problem?
Title: Re: problems with copying renderTextures
Post by: SpeCter on January 09, 2016, 01:44:58 pm
sf::RenderTexture temp = front;
front = back;
back = temp;

You are in fact trying to copy the RenderTexture around.
The other thread uses pointers(which can be copied) to do what you want.

Not trying to be rude here, but you should get a fundamental knowledge about C++ first.
Title: Re: problems with copying renderTextures
Post by: soaup on January 09, 2016, 03:16:19 pm
Yes, i did it with pointers and it works. I forgot pointers.