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

Author Topic: Anti-aliasing causing small graphical glitch?  (Read 3065 times)

0 Members and 1 Guest are viewing this topic.

Sub

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Anti-aliasing causing small graphical glitch?
« on: October 27, 2013, 01:38:33 am »
I'm either confused on how to properly enable anti-aliasing, or it's causing a small graphical bug in my program in the form of small squares that appear randomly around the screen.  This is a zoomed in screenshot that I took to show what I mean.

http://i.imgur.com/cXX5Inw.png

And here's a small test program I made to make sure the problem wasn't elsewhere in my code
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow MainWindow;
   
    sf::ContextSettings ContextSetter;
    ContextSetter.antialiasingLevel = 16;

    const int DEFAULT_SCREEN_WIDTH = 800;
    const int DEFAULT_SCREEN_HEIGHT = 600;
    MainWindow.create( sf::VideoMode
( std::min(sf::VideoMode::getDesktopMode().width, (unsigned)DEFAULT_SCREEN_WIDTH)
, std::min(sf::VideoMode::getDesktopMode().height, (unsigned)DEFAULT_SCREEN_HEIGHT)
, 32), "Antialiasing Test", sf::Style::Default, ContextSetter);

    sf::Event Event;
    bool Quit = false;
    while (Quit != true)
    {
        while (MainWindow.pollEvent(Event))
        {     
            if (Event.type == sf::Event::Closed)
            {
                Quit = true;
            }         
        }

        MainWindow.clear(sf::Color(60, 90, 150));

        MainWindow.display();
    }
}

Anyone have an idea on what I'm doing wrong or what's causing this?  I'm using a nightly build that I last updated on 9.27.13.  I took a look at some of my old screenshots and this artifact doesn't appear to be on them, so I'm thinking it might be a recent change which causes this.

edit:  I just did a test with SFML 2.0 and it still happens, so that's not it.
edit2: This is what it looks like when not zoomed in: http://i.imgur.com/SY39cGI.png
« Last Edit: October 27, 2013, 02:11:06 am by Sub »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Anti-aliasing causing small graphical glitch?
« Reply #1 on: October 27, 2013, 01:49:59 am »
Not sure what could be causing that.  I get a solid blue window with that code, none of the suspiciously well-arranged little purple squares you have.  Though I had to add an sf::Event instance to that code since you never declared "Event" (how did you get that to compile?).

Incidentally, because the AA level you pass to the Window constructor is a hint, not an absolute, I added this line to the test code:
std::cout << "Actual AA level: " << MainWindow.getSettings().antialiasingLevel;
And that gave me 8, not 16.  You may want to check what your actual level is too.
« Last Edit: October 27, 2013, 01:53:51 am by Ixrec »

Sub

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: Anti-aliasing causing small graphical glitch?
« Reply #2 on: October 27, 2013, 02:03:15 am »
I accidentally erased the line where I added an sf::Event when I was pasting it, it's now edited back in.

Anyway, I tried your test and it's giving me an AA level of 1.  I'm not quite sure why that is, but yeah.

I decided to create a project on my laptop to see if it occurs there, and it actually works fine on my laptop, so it looks like it might just be a problem with my desktop.

My desktop is an AMD FX-6300 3.50 GHz, 4 gigs of ram, with a geforce GTX 470.  Not sure if any of that is relevant.

edit:  Considering this problem didn't occur in the past on my desktop (I have some old screenshots of SFML projects that I checked), I wonder if it's because of a video card driver update?
« Last Edit: October 27, 2013, 02:20:56 am by Sub »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Anti-aliasing causing small graphical glitch?
« Reply #3 on: October 27, 2013, 02:23:07 am »
Wow, a desktop that doesn't even do 2x AA?  That may very well be the problem here.

On the other hand a quick google implies the GTX 470 should have at least 32x AA, so I have no idea what's going on.

Sub

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: Anti-aliasing causing small graphical glitch?
« Reply #4 on: October 27, 2013, 02:34:13 am »
Using the same code from the example above

SFML 2.0 gives me a AA of 1.
SFML Nightly from 9.27.13 gives me a AA of 16.

The graphical bugs happen in both cases so that's not it.  I'm updating my drivers right now, hopefully that fixes it.

edit:  Driver update didn't fix it.  The glitch is kind of interesting though, it almost looks like a version of Conway's Game of Life with different rules.
« Last Edit: October 27, 2013, 02:37:23 am by Sub »

G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: Anti-aliasing causing small graphical glitch?
« Reply #5 on: October 27, 2013, 12:49:23 pm »
It looks like braille. :p

 

anything