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

Author Topic: Anti-aliasing RenderTexture  (Read 2409 times)

0 Members and 1 Guest are viewing this topic.

kehvatsu

  • Newbie
  • *
  • Posts: 3
    • View Profile
Anti-aliasing RenderTexture
« on: May 31, 2013, 09:59:50 pm »
Hi,

I'm working on a game that relays heavily on RenderTexture for graphics of the game. RenderTexture feature of SFML is absolutely the best I have seen in any other PC graphics framework! My only problem is that I need to anti-alias the textures but this is currently not supported on SFML. So I have been thinking about hacks to get anti-aliasing effect for my texture.

Right now I'm thinking that lets say I want to draw sf::CircleShape with radius of 1 on to the RenderTexture and anti-alias it. I would draw the actual circle in radius of 2 and then get the sf::Texture from sf::RenderTexture, then use the copyToImage() and create sf::image from the texture. Then create new empty sf::Image of size 1x and then use some down sample algorithm to copy the pixels from the 2x sized sf::image to the new one. After that I would create texture from the sf:image and use that texture to use actual sprite.

But this seems overly complicated for such a simple task. Is there any easier way to achieve anti-aliasing for sf::RenderTexture? The method does NOT need to be fast. I will render the textures at the beginning of the game once.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Anti-aliasing RenderTexture
« Reply #1 on: May 31, 2013, 10:49:25 pm »
Scaling the sprite that displays the texture would have the same effect as your complicated solution, but with just one line of code and no extra processing.
Laurent Gomila - SFML developer

 

anything