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

Author Topic: Switching antialiasing on and off during runtime  (Read 2005 times)

0 Members and 1 Guest are viewing this topic.

Maximus

  • Newbie
  • *
  • Posts: 2
    • View Profile
Switching antialiasing on and off during runtime
« on: January 06, 2010, 10:15:05 pm »
Is there any possibility of enabling and disabling antialiasing during the application runtime? I've enabled it using the WindowsSettings class, given as a parameter to the RenderWindow class constructor. I find it to be a must-have to be able to change the level of antialiasing in my application's options, as well as switch it on and off on the go. The latter is needed because I'm doing picking of objects by the "color method" - drawing the objects to an invisible buffer when the user presses the mouse button and then checking the color of the clicked pixel to determine, which object has been selected. The antialiasing is applied even to this invisible buffer, thus providing me with erroneous readings when I click on the exact borders of the objects.

I'd be happy if there is any solution to this problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Switching antialiasing on and off during runtime
« Reply #1 on: January 06, 2010, 11:00:55 pm »
You an enable and disable anti-aliasing using OpenGL:
Code: [Select]
glDisable(GL_MULTISAMPLE_ARB);
...
glEnable(GL_MULTISAMPLE_ARB);
Laurent Gomila - SFML developer

Maximus

  • Newbie
  • *
  • Posts: 2
    • View Profile
Switching antialiasing on and off during runtime
« Reply #2 on: January 11, 2010, 11:06:59 pm »
Thanks, it was definitely the solution I've been looking for. I had to define it manually, though, but it works now.