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

Author Topic: sf::RenderImage Anti aliasing not working?  (Read 2855 times)

0 Members and 2 Guests are viewing this topic.

Austech

  • Newbie
  • *
  • Posts: 23
    • View Profile
sf::RenderImage Anti aliasing not working?
« on: January 02, 2011, 11:31:06 pm »
I'm trying to draw objects to a RenderImage, and draw the RenderImage to the window.

The problem is that if I were to draw something to a render image, and draw the sprite of the render image to the window, there's no Anti aliasing.

If I were to draw the objects directly to the window, it has Anti aliasing. But it would really be a struggle with my class structure to do this, plus it would be a lot easier to do things with a render image.

Here's an example I made up with this happening:

Code: [Select]
int main(int argc,const char *argv[])
{
sf::ContextSettings cs;
cs.AntialiasingLevel = 12;
sf::RenderWindow window(sf::VideoMode(800,600), "Test",sf::Style::Close,cs);
window.SetFramerateLimit(60);

sf::RenderImage rimg;
rimg.Create(800,600);
rimg.Clear();
rimg.Draw(sf::Shape::Circle(100,100,50,sf::Color(255,255,255)));
rimg.Display();
sf::Sprite spr;
spr.SetImage(rimg.GetImage());
while(window.IsOpened())
{
while(window.GetEvent(event))
{
if(event.Type == sf::Event::Closed)
{
window.Close();
}
}
window.Clear();
window.Draw(spr);
window.Draw(sf::Shape::Circle(100,400,50,sf::Color(255,255,255)));
window.Display();
}
}


Here's what I get:


Any help is appreciated, and thanks a lot in advance. : )

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::RenderImage Anti aliasing not working?
« Reply #1 on: January 02, 2011, 11:34:06 pm »
Well, you can get texture smoothing with rimg.SetSmooth(true). This is not anti-aliasing but the result should the close enough.
Laurent Gomila - SFML developer

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
sf::RenderImage Anti aliasing not working?
« Reply #2 on: January 03, 2011, 09:37:27 am »
12 is an odd number for anti-aliasing. Try using 4x and 8x, and see if it changes anything.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::RenderImage Anti aliasing not working?
« Reply #3 on: January 03, 2011, 10:44:50 am »
Quote
12 is an odd number for anti-aliasing. Try using 4x and 8x, and see if it changes anything.

It won't change anything because:
1. SFML finds the closest valid anti-aliasing level anyway
2. setting up anti-aliasing on the window won't help, he wants anti-aliasing on the render-image
Laurent Gomila - SFML developer

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
sf::RenderImage Anti aliasing not working?
« Reply #4 on: January 03, 2011, 10:54:06 am »
Right, that makes sense. I wasn't sure.

 

anything