Hi!
I have a problem with rendering sprites.
The are rendered OK unless they are rotated.
First image shows basic sprite rendering, the second - after rotation.
Also if rotation angle is 0, 90, 270 or 360 degree there's no problem.
I tried on two different PCs (but both running linux mint), i tried to turn on V Sync, anti-aliasing, texture smoothing but no result.
Here's a code example:
void test()
{
sf::ContextSettings settings;
settings.antialiasingLevel = 8;
sf::RenderWindow mWindow(sf::VideoMode(1024, 768), "My window", sf::Style::Default, settings );
mWindow.setVerticalSyncEnabled(true);
mWindow.setFramerateLimit(60);
sf::Texture back_texture;
back_texture.loadFromFile("assets/back.png");
back_texture.setSmooth(true);
sf::Sprite bgSprite;
bgSprite.setTexture(back_texture);
sf::Texture m_texture;
m_texture.loadFromFile("assets/missile_tmp.png");
sf::Sprite mSprite;
mSprite.setTexture(m_texture);
//!!!!!!!!!!!PROBLEM IS HERE !!!!!!!!!!!!
mSprite.setRotation(45);
mSprite.setPosition(300,0);
sf::Clock clock;
sf::Time timeSinceLastUpdate = sf::Time::Zero;
sf::Time timePerFrame = sf::seconds( 1.0f / 60.0f );
while( mWindow.isOpen() )
{
sf::Time dt = clock.restart();
timeSinceLastUpdate += dt;
// run at constant time intervals
while( timeSinceLastUpdate > timePerFrame )
{
timeSinceLastUpdate -= timePerFrame;
//processInput;
sf::Event event;
while( mWindow.pollEvent(event) )
{
if (event.type == sf::Event::Closed)
mWindow.close();
}
//some update here
}
mWindow.clear();
mWindow.setView(mWindow.getDefaultView());
mWindow.draw(bgSprite);
mWindow.draw(mSprite);
mWindow.display();
}
}
What am i doing wrong?