Hey guys!
I have a dynamic width requirement for a sprite generated from a RenderTexture, but redundant calls to rt.create don't seem to reinitialize it to the new width ( apparently I'm not supposed to do it this way )
Is there a proper way to destroy and recreate a RenderTexture?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Basically I've created a custom font class that makes a single sprite out of a line of text, but only when the text changes. If I call create redundantly, I see graphical artifacts at the edge of my sprite, which tells me the texture probably didn't resize. Hopefully there is a better solution than creating the render texture once to the entire width of the window (since I may have dozens of these objects)
This is what I'm doing when the text changes..
rt.create( width, height);
rt.clear( sf::Color( 0,0,0,0));
DrawText( pszString, rshader, tint);
rt.display();
textureText = rt.getTexture();
spriteText.setTexture( textureText);
Any feedback is appreciated, thank you!!