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

Author Topic: Problems with smoothing a textured shape  (Read 1453 times)

0 Members and 1 Guest are viewing this topic.

Sebastian Huggbard

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Problems with smoothing a textured shape
« on: August 29, 2022, 01:43:09 pm »
Dear Ladies and Gentlemen,

it is the first time for me that i'm in your great forum and i hope i'm in the correct thread.
I'm using SFML.Net with C# and i'm new to SFML but not to C#.
My Problem is that i'm drawing a textured  shape (circle) an i can't get the edge smooth.
I#m using Win10. VisualStudio 2019 and SFML.Net-2.4-32-bit.
It would be great if you could help me ;)

Here is a picture:
https://ibb.co/cX407g7

Here is my code:
    class Program
    {
        const int WIDTH = 640;
        const int HEIGHT = 480;
        const string TITLE = "First";

        static void Main(string[] args)
        {

            VideoMode mode = new VideoMode(WIDTH, HEIGHT);
            RenderWindow window = new RenderWindow(mode, TITLE);
            window.SetVerticalSyncEnabled(true);

            Texture texture = new Texture(@"E:\SFML\SFML_First\Gold.png");
            texture.Smooth = true;
           
            CircleShape cshape = new CircleShape(50);
            cshape.TextureRect = new IntRect(10, 10, 100, 100);

            cshape.Texture = texture;
         
           

            while (window.IsOpen)
            {
                window.DispatchEvents();
                window.Clear(Color.Black);
                window.Draw(cshape);
                window.Display();
            }
        }
    }
 

 Best regards,
Sebastian

Sebastian Huggbard

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Problems with smoothing a textured shape
« Reply #1 on: August 29, 2022, 03:12:51 pm »
I got the solution.
The "settings" in the WindowsRenderer ;-)!


Best regards,
Sebastian

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Problems with smoothing a textured shape
« Reply #2 on: September 01, 2022, 09:41:36 pm »
It's called anti-aliasing and as you discovered can be set on the context settings when creating the render window.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/