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

Author Topic: Shape antialiasing  (Read 13328 times)

0 Members and 1 Guest are viewing this topic.

opatut

  • Newbie
  • *
  • Posts: 25
    • View Profile
Shape antialiasing
« on: November 27, 2010, 12:48:43 am »
Hey Laurent,

how could I get antialiasing to work with Shapes? Will OpenGL antialiase them even though they have no texure or do I have to go for a Sprite (which would not at all be a nice way to solve my problem).

I'm using SFML2 and I've got antialiasing enabled for the RenderWindow.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shape antialiasing
« Reply #1 on: November 27, 2010, 07:41:21 am »
Antialiasing is about geometry, not textures. So it should work.

Are you sure that you actually got the AntialiasingLevel that you requested (have you checked window.GetSettings().AntialiasingLevel)?
Laurent Gomila - SFML developer

Dlaor

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shape antialiasing
« Reply #2 on: May 12, 2011, 10:48:18 pm »
Hey, I have this problem too. I want to draw shapes like circles and lines and stuff, but without anti-aliasing, it looks pretty ugly. Using textures is not an option. I've checked window.GetSettings().AntialiasingLevel, and it outputs 4 every time, so it should work. I dunno if it matters, but I'm using SFML.NET 2.0. Any help would be appreciated!

Dlaor

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shape antialiasing
« Reply #3 on: May 13, 2011, 05:30:10 pm »
Sorry for the double post, but I found out that drawing shapes directly to the screen makes them anti-aliased, but drawing them to a RenderImage and then drawing that one to the screen, it gets ugly edges and stuff. Is there any way around this? Drawing them directly to the screen is not an option, neither is using textures.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shape antialiasing
« Reply #4 on: May 13, 2011, 06:25:24 pm »
Antialiasing must be enabled in the render-image itself. But this is not supported (yet).
Laurent Gomila - SFML developer

Dlaor

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shape antialiasing
« Reply #5 on: May 15, 2011, 09:27:47 pm »
Hmm. Is there any way I can implement this myself? It is pretty much a requirement for the game I'm making, and I don't see any way around it.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shape antialiasing
« Reply #6 on: May 15, 2011, 10:41:37 pm »
It depends which revision of SFML 2 you use.
Laurent Gomila - SFML developer

Dlaor

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shape antialiasing
« Reply #7 on: May 16, 2011, 04:33:18 pm »
Using the latest Git revision.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shape antialiasing
« Reply #8 on: May 16, 2011, 04:43:12 pm »
In src/SFML/Graphics/RenderImageImplFBO.cpp, change line 87 from
Code: [Select]
myContext = new Context;
... to
Code: [Select]
myContext = new Context(ContextSettings(...), 1, 1);
(put whatever context settings you want in "...")
Laurent Gomila - SFML developer

Dlaor

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shape antialiasing
« Reply #9 on: May 16, 2011, 06:00:03 pm »
Okay, one more problem. I'm using the dotnet bindings, so I can't change the C++ source. Do you know what .cs file I need to edit to change this in the dotnet binding of SFML to fix the problem? Or would I need to change and compile the C bindings (since SFML.NET uses them)?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shape antialiasing
« Reply #10 on: May 16, 2011, 06:36:53 pm »
You need to change the C++ source (SFML is not completely rewritten for each language ;)), then recompile CSFML and finally SFML.Net.
Laurent Gomila - SFML developer

Dlaor

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shape antialiasing
« Reply #11 on: May 18, 2011, 01:44:20 pm »
Okay, thanks for all the help so far!  :D
I'll go try to compile the CSFML libraries now, I'll report back if something doesn't work!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shape antialiasing
« Reply #12 on: May 18, 2011, 02:11:25 pm »
Sorry it wasn't 100% clear in my previous message, but of course you must start by recompiling SFML (C++) itself, before CSFML and SFML.Net ;)
Laurent Gomila - SFML developer

Dlaor

  • Newbie
  • *
  • Posts: 15
    • View Profile
Shape antialiasing
« Reply #13 on: May 18, 2011, 02:47:37 pm »
Quote from: "Laurent"
Sorry it wasn't 100% clear in my previous message, but of course you must start by recompiling SFML (C++) itself, before CSFML and SFML.Net ;)

Yeah, I understood that. I made some project files with CMake and compiled the project successfully... although, now I can't get CMake to make the project files for CSFML... do you know what I could be doing wrong?

I copied FindSFML.cmake to C:\Program Files (x86)\CMake 2.8\share\cmake-2.8\Modules, by the way.
(and ignore the folder name sfmlSVN, that was a folder from way back when SFML still used SVN)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shape antialiasing
« Reply #14 on: May 18, 2011, 03:14:10 pm »
FindSFML.cmake can't find SFML if it's not in a standard path, you must tell CMake where you compiled/installed it. I don't remember the name of the variable to create (should be SFMLDIR or SFML_DIR), but anyway look at the comments in FindSFML.cmake, everything is explained.
Laurent Gomila - SFML developer