Thread: SDL2 Line Artifacting

  1. #1
    Registered User
    Join Date
    Jun 2020
    Posts
    4

    SDL2 Line Artifacting

    Hi there, I have been using SDL2 for last couple months, however a problem occurred that I still haven't been able to fix.

    When drawling lines to the screen a weird problem occurs as seen in the attachment below.
    SDL2 Line Artifacting-2020-06-02_10-55-png

    I could show you the code, however after trying various snippets of other people's code, I still got the same problem, so I suspect this isn't a problem with my code or SDL2. I was wondering if anyone has ever had any problem like this, and how to fix it.

    Cheers!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,060
    SDL2 antialiasing at DuckDuckGo
    What you're seeing are the cumulative rounding errors of drawing a diagonal line that is not exactly 45'.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2020
    Posts
    4
    Quote Originally Posted by Salem View Post
    SDL2 antialiasing at DuckDuckGo
    What you're seeing are the cumulative rounding errors of drawing a diagonal line that is not exactly 45'.
    Hi there, thanks for the reply, however this is not the only occasion when this happens.
    SDL2 Line Artifacting-2020-06-02_10-56-png

    As you can see from above, this is my raycast engine. It worked fine when I used X11's line function, but using SDL2 I once again get this artifacting,
    even the wall which is a straight line.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,060
    Some code and bigger pictures might help.
    They're already fuzzy before you describe what's wrong.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jun 2020
    Posts
    4
    Quote Originally Posted by Salem View Post
    Some code and bigger pictures might help.
    They're already fuzzy before you describe what's wrong.
    Of course, here's a gif of a spinning line.
    SDL2 Line Artifacting-peek-2020-06-02-18-07-gif

    I would give code, however I tried several code snippets and they all had the same results.
    This is why I posted this in the Linux section, because this is probably not a problem with the
    code, but perhaps with the OS.

  6. #6
    Registered User
    Join Date
    Jun 2020
    Posts
    4
    Well, seems like this was a problem with OpenGL's lines where it draws an extra pixel at the start and end of each line.

    This problem seems to be present at only a select group of Nvidia cards, I happen to have one of them, quite unfortunate.

    Either way, thanks for the help and replies.

    Cheers!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple SDL2 made menu
    By joakim12 in forum Game Programming
    Replies: 1
    Last Post: 12-10-2019, 11:23 AM
  2. Replies: 1
    Last Post: 06-09-2018, 11:14 AM
  3. Code::Blocks - MinGW - Problems with GLEW and SDL2
    By Raygler in forum C++ Programming
    Replies: 2
    Last Post: 06-27-2016, 11:59 AM
  4. SDL2 - GCC vs. G++ segmentation fault
    By Zacariaz in forum C Programming
    Replies: 8
    Last Post: 06-01-2015, 06:23 AM
  5. SDL2 Codeblocks error
    By russiancircles in forum Game Programming
    Replies: 2
    Last Post: 05-08-2014, 06:08 AM

Tags for this Thread