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

Author Topic: Weird sprite problems  (Read 1304 times)

0 Members and 1 Guest are viewing this topic.

WonderMike

  • Newbie
  • *
  • Posts: 3
    • View Profile
Weird sprite problems
« on: December 26, 2012, 10:39:39 pm »
Hey, could someone please explain this behavior with sprites. I'm loading this image:


Like you can see, this picture is nicely sharp and not antialiased. After loading this image to sprite and trying to show it in the game, picture looks like this:


Picture is totally different looking. Sprite looks like antialiased and it's unsharp. What is causing this problem with sprite?
« Last Edit: December 26, 2012, 10:50:44 pm by WonderMike »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10827
    • View Profile
    • development blog
    • Email
Re: Weird sprites
« Reply #1 on: December 26, 2012, 10:52:51 pm »
If you don't call setSmooth(true) on the texture, then the sprite is most probably between two 'interger' positions (e.g. 0.3 or 0.6). Try to round the positions to integers (not as data type, but as in 0.f, 1.f, 2.f, ...).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

WonderMike

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Weird sprite problems
« Reply #2 on: December 26, 2012, 10:54:46 pm »
It seemed that when I set Smooth property (I'm using .NET version) to false, sprite returned normal. Interesting that sprite is rendered with smoothing by default...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10827
    • View Profile
    • development blog
    • Email
Re: Weird sprite problems
« Reply #3 on: December 26, 2012, 11:00:43 pm »
But you're using SFML 2.0 right? Because there it's set to false by default... ???
Well maybe it's a bug in the .NET version and maybe it has already been fixed on GitHub, but I don't know anything about the .NET version... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

WonderMike

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Weird sprite problems
« Reply #4 on: December 27, 2012, 10:48:47 am »
Actually I'm using 1.6 but after this weirdness I'm starting to belive it's time to change to 2.0 :D It seems to be more fixed version of SFML after all.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10827
    • View Profile
    • development blog
    • Email
Re: Weird sprite problems
« Reply #5 on: December 27, 2012, 10:57:11 am »
Actually I'm using 1.6...
Okay, then yes the default behavior is SetSmooth(true). ;)

but after this weirdness I'm starting to belive it's time to change to 2.0 :D It seems to be more fixed version of SFML after all.
Good decision! ;D
Yes SFML 2 has less bugs or at least less severe bugs, but with quite a few nice features (RenderTexture, VertexArray, ...).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything