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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - andywood

Pages: [1]
1
Graphics / Rendering problem with RenderTexture.getTexture()
« on: June 18, 2016, 02:41:43 am »
I have code like this:

sf::Sprite sprite(myRenderTexture.getTexture());
myRenderTarget.draw(sprite);

It renders incorrectly. I'm not sure where the bits are coming from, but it's drawing the wrong bits. However if I simply introduce one intermediate texture:

sf::Texture texture = myRenderTexture.getTexture();
sf::Sprite sprite(texture);
myRenderTarget.draw(sprite);

Then it renders correctly. The second version is acceptable, but the seemingly needless copy is bothering me. It also makes me think there is something going on in SFML that I don't understand. Also, there is another part in my code (the rendering of the main surface to the window, in fact) that works like the first example, and it's fine. I've rearranged things a few different ways and made sure object lifetime isn't an issue, but every time I remove that texture copy, I get the same bad render (the bad result is always the same, not random).

Pages: [1]
anything