SFML community forums

Help => Graphics => Topic started by: WonderMike on December 26, 2012, 10:39:39 pm

Title: Weird sprite problems
Post by: WonderMike on December 26, 2012, 10:39:39 pm
Hey, could someone please explain this behavior with sprites. I'm loading this image:
(http://i46.tinypic.com/kbaoid.png)

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:
(http://i46.tinypic.com/zx8ze8.png)

Picture is totally different looking. Sprite looks like antialiased and it's unsharp. What is causing this problem with sprite?
Title: Re: Weird sprites
Post by: eXpl0it3r 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, ...).
Title: Re: Weird sprite problems
Post by: WonderMike 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...
Title: Re: Weird sprite problems
Post by: eXpl0it3r 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... ;)
Title: Re: Weird sprite problems
Post by: WonderMike 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.
Title: Re: Weird sprite problems
Post by: eXpl0it3r 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, ...).