1
Graphics / Re: sf::Shape rendering seems to break sf::Text rendering (2.0RC)
« on: November 08, 2012, 08:43:26 pm »
This bit of code is helping me work around the issue. Anywhere you need to render text or sprites and it sometimes renders wrongly, insert a call to this function right before it to ensure the texture will get re-bound properly. It's a hacky thing that creates a 1x1 texture and draws a sprite with it offscreen.
#include <SFML\Graphics.hpp>
void WorkaroundAMDBug(sf::RenderWindow* window)
{
static sf::Texture amdWorkaroundImage;
static sf::Sprite sprite;
if (amdWorkaroundImage.getSize() == sf::Vector2u(0,0))
{
amdWorkaroundImage.create(1, 1);
sprite.setTexture(amdWorkaroundImage);
sprite.setPosition(-20, -20); // offscreen
}
window->draw(sprite);
}
void WorkaroundAMDBug(sf::RenderWindow* window)
{
static sf::Texture amdWorkaroundImage;
static sf::Sprite sprite;
if (amdWorkaroundImage.getSize() == sf::Vector2u(0,0))
{
amdWorkaroundImage.create(1, 1);
sprite.setTexture(amdWorkaroundImage);
sprite.setPosition(-20, -20); // offscreen
}
window->draw(sprite);
}