SFML community forums
Help => Graphics => Topic started by: Austech 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:
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:
(http://i51.tinypic.com/zj6s77.jpg)
Any help is appreciated, and thanks a lot in advance. : )
-
Well, you can get texture smoothing with rimg.SetSmooth(true). This is not anti-aliasing but the result should the close enough.
-
12 is an odd number for anti-aliasing. Try using 4x and 8x, and see if it changes anything.
-
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
-
Right, that makes sense. I wasn't sure.