SFML community forums

Help => Graphics => Topic started by: Great Programmer on July 21, 2011, 07:52:21 am

Title: Ugly sprite drawing
Post by: Great Programmer on July 21, 2011, 07:52:21 am
Hi.

I'm trying to draw an image on the screen, but the one I draw looks much worse than the original.

On the left the real image, on the right it's as sfml draws it:

(http://i53.tinypic.com/122yknp.png)

I tried bmp, png and jpg formats, as well as different sizes - always the same.
What to do if I want to draw the image exactly as it's in the file?


Here is my code for the image:

Code: [Select]
RenderWindow window;
window.Create(VideoMode(640,480,32),"SFML Window");

Image img;
img.LoadFromFile("kon.PNG");

Sprite sprite;
sprite.SetImage(img);
sprite.SetPosition(100.f,100.f);

...

window.Clear(Color(0xff,0xff,0xff));
window.Draw(sprite);
window.Display();
Title: Ugly sprite drawing
Post by: Laurent on July 21, 2011, 08:33:07 am
Code: [Select]
img.SetSmooth(false)
Title: Ugly sprite drawing
Post by: slotdev on July 21, 2011, 06:12:09 pm
Laurent, this must be the most commonly asked question on SFML.

I suppose if an New Users FAQ were to be written, would that help? Would people even read it (in my experience, no)?

As a new user myself, I am tempted to write an Idiot's Guide to SFML...

Ed
Title: Ugly sprite drawing
Post by: Laurent on July 21, 2011, 06:29:28 pm
I have a better solution: smoothing is disabled by default in SFML 2 ;)