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

Author Topic: Short flicker during program load when on the Main Display  (Read 2673 times)

0 Members and 1 Guest are viewing this topic.

guyyst

  • Newbie
  • *
  • Posts: 5
    • View Profile
Short flicker during program load when on the Main Display
« on: January 16, 2016, 03:59:15 am »
I am writing a small image viewer and when I start my program it shows the image I loaded, flickers to black, and back to the image.
Strangely, when I set up my window to start on a secondary monitor the flickering goes away.

I filmed my left monitor (configured as the main display) while opening an image (for testing it's just a green BG) with my editor. A series of images of the launch (~200 ms):
http://i.imgur.com/s9jc8n7.png
As you can see the screen starts out green but then flashes to black and back to green.

This is what it looks like when I set my other monitor (right) as the main display but make sure that the window is still being displayed on the left monitor using window.setPosition(sf::Vector2i(-1920, 0)).
http://i.imgur.com/F8W38I9.png
No flickering.

I stripped down my code to this and it's still happening:
int main()
{
        sf::RenderWindow window(sf::VideoMode(1920, 1080), "Test", sf::Style::None);
        window.setPosition(sf::Vector2i(0, 0));

        //window.setPosition(sf::Vector2i(-1920, 0));
        //This would make it work for my left monitor if it were configured as a secondary display

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        switch (event.type)
                        {
                        case sf::Event::Closed:
                                return 0;
                        }
                }
                window.clear(sf::Color::Green);
                window.display();
        }
        return 0;
}
 

Changing the window style to full screen doesn't help either.
If I were to offset the window by 1+ pixel, so that the task bar is overlapping the window, the issue is gone.
Is this a problem with full screen/borderless full screen (achieved with sf::style::None) on the main display, or just the expected behavior for such an application?
« Last Edit: January 20, 2016, 11:35:59 am by guyyst »

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Short flicker during program load when on the Main Display
« Reply #1 on: January 21, 2016, 11:59:59 am »
Just a wild guess:
Is your graphics-driver up to date?

guyyst

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Short flicker during program load when on the Main Display
« Reply #2 on: January 24, 2016, 06:00:01 pm »
Just a wild guess:
Is your graphics-driver up to date?

Yes, I'm using the driver version 353.82 on the GTX 780.

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Short flicker during program load when on the Main Display
« Reply #3 on: January 31, 2016, 01:06:36 pm »
at a glance, it seems that your issue related to display mode change.
Try to replace Style.None with Style.Default. I think it will eliminate your flicks.

Something like that:
sf::RenderWindow window(sf::VideoMode(800, 600), "Test", sf::Style::Default);
 

If you need to switch into fullscreen mode, then use this code:
sf::RenderWindow window(sf::VideoMode::DesktopMode, "Test", sf::Style::Fullscreen);
 

But the last code leads to display flicker due display mode change
« Last Edit: January 31, 2016, 01:16:36 pm by mkalex777 »

 

anything