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

Author Topic: SFML rotation looks awful  (Read 1588 times)

0 Members and 1 Guest are viewing this topic.

fubris

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
SFML rotation looks awful
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10927
    • View Profile
    • development blog
    • Email
Re: SFML rotation looks awful
« Reply #1 on: December 27, 2017, 07:47:16 pm »
Try adjusting the anti-aliasing settings at window creation.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

fubris

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: SFML rotation looks awful
« Reply #2 on: December 27, 2017, 09:09:48 pm »
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

 

anything