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

Author Topic: Disabling anti-aliasing  (Read 7639 times)

0 Members and 1 Guest are viewing this topic.

acrin1

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://www.crpgdev.com
Disabling anti-aliasing
« on: September 19, 2007, 08:22:25 pm »
Hi,

I've noticed that by default anti-aliasing seems to be turned on. I looked in the documentation and thought that setting the renderwindow aliasing value to 0 would disable it.

sf::RenderWindow App(sf::VideoMode(800, 600), "RPG", sf::Window::Fixed, 0 );

Am I misreading the documentation? The reason I'm asking is because I'm using small tiles (32x32) and they look better without any smoothing.

Thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Disabling anti-aliasing
« Reply #1 on: September 19, 2007, 08:33:06 pm »
Antialiasing is turned off by default.

I can see two reasons why your sprites look smooth :

- Antialiasing is forced in your driver's control panel (you should select "let the application choose")
- It's because of the texture filtering ; using Image::SetSmooth can disable it

I think it's the second one, as antialiasing only affects primitive edges. In fact it won't make any difference unless you use 3D (OpenGL) code.
Laurent Gomila - SFML developer

acrin1

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://www.crpgdev.com
Disabling anti-aliasing
« Reply #2 on: September 19, 2007, 11:22:41 pm »
Quote from: "Laurent"
Antialiasing is turned off by default.

I can see two reasons why your sprites look smooth :

- Antialiasing is forced in your driver's control panel (you should select "let the application choose")
- It's because of the texture filtering ; using Image::SetSmooth can disable it

I think it's the second one, as antialiasing only affects primitive edges. In fact it won't make any difference unless you use 3D (OpenGL) code.


That's great - your second suggestion solved it:

sf::Image BackgroundImage;
    if (!BackgroundImage.LoadFromFile("images/terrain_tiles.png"))
        return EXIT_FAILURE;
   BackgroundImage.SetSmooth(false);
    sf::Sprite Background(BackgroundImage);

Thanks for your quick response.

AndyZ

  • Newbie
  • *
  • Posts: 1
    • View Profile
Disabling anti-aliasing
« Reply #3 on: January 19, 2008, 04:08:20 pm »
I just had to look this up to make my images appear pixel-sharp.

I would argure that either SetSmooth should be false by default and/or there should be a setDefaultSmoothing function so it does not have to be set after every image is loaded.

But it looks like a very good library otherwise  :)