SFML community forums
Help => Graphics => Topic started by: fubris on December 27, 2017, 07:42:39 pm
-
Everything was working smoothly just as advertised until I started rotating sprites. I searched all over the web and it seems I am the only one with this issue.
this is my drawing code:
sf::Texture tex;
sf::Sprite cartoon;
sf::RenderWindow canvas(sf::VideoMode(800, 600), "SFML window");
assert(tex.loadFromFile("..\\Debug\\blue.png"));
cartoon.setTexture(tex);
cartoon.setPosition(300, 300);
canvas.draw(cartoon);
the above works perfectly as seen in the the attachment "norotation.png"
cartoon.setPosition(300, 300);
cartoon.setOrigin(tex.getSize().x / 2.f, tex.getSize().y / 2.f);
cartoon.setRotation(12);
canvas.draw(cartoon);
The above code does rotate the sprite but result looks awful and pixelated as seen in the attachement "rotated.png"
why on earth is the rotated image look so bad?
-
Try adjusting the anti-aliasing settings at window creation.
-
thanks... you suggestion of anti-aliasing sent me to this thread
https://en.sfml-dev.org/forums/index.php?topic=8685.0
where i discovered that anti-alising on the window has been deprecated and has been replaced with Setsmooth(true) on the texture element. either way my sprite looks much better now. thanks ;D