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

Author Topic: Issue using RenderTextures on full-screen window  (Read 3795 times)

0 Members and 1 Guest are viewing this topic.

IngloriousTom

  • Newbie
  • *
  • Posts: 17
    • View Profile
Issue using RenderTextures on full-screen window
« on: October 06, 2014, 05:21:35 pm »
Hello,

I've currently a big and strange issue related to render textures and full-screen windows.

It's a really strange behavior : the render texture first "clear" or "draw" will cause the screen to blink for about 1s (the entire monitor, and even other monitors if using multiple monitors).
But only if the sfml window is full-screen and at topmost position.

Here is the minimal code where I was able to reproduce the problem:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window", sf::Style::Fullscreen);
        sf::RenderTexture text;
        text.create(100,100);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

                if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
                {
                        text.clear(); // First call will cause the screen to blink
                }

        window.clear(sf::Color::White);
                window.display();
    }

    return 0;
}

When using render texture profusely it's a really big issue.

Somehow, I cant reproduce this behavior on every computers. In our offices, 3 out of 5 Windows computers are affected, but none with linux. It looks like a driver issue but I use the last AMD driver. I would love to know if it's a known issue and if there is a fix.

I tried some things and it appears that when the window is no longer foreground (if another window is above it), the monitor is no longer blinking.

Thanks !
« Last Edit: October 06, 2014, 05:25:49 pm by IngloriousTom »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Issue using RenderTextures on full-screen window
« Reply #1 on: October 06, 2014, 05:25:32 pm »
Might be related to #434, but since this also affects all the other monitors, it might indeed be a driver issue.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

IngloriousTom

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Issue using RenderTextures on full-screen window
« Reply #2 on: October 06, 2014, 05:35:04 pm »
It really looks like my behavior, but I've tried the code they posted and it does not flicker on my computer.

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Issue using RenderTextures on full-screen window
« Reply #3 on: October 06, 2014, 08:36:03 pm »
There are two implementations of RenderTextures, one uses GL_EXT_framebuffer_object and should run smoothly, the other is a fallback which is creating a hidden window and contexts on that hidden window.
I suspect the fallback implementation of being buggy (I just saw how a clear had no effect in my program) and maybe some newer OS handles that window switching a bit differently then when that code was implemented. Nearly noone has a graphics card anymore that does not support framebuffer objects so it does not get tested much.
I would check if those 3 computers support that OpenGL extension (there exists an OpenGL extension viewer or you could use a debugger to see which implementation is selected at runtime) and they have current drivers. What could also go wrong is if some new card is only supporting GL_ARB_framebuffer_object and does not advertise the older, slightly different EXT extension anymore.

_Fiction_

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Issue using RenderTextures on full-screen window
« Reply #4 on: July 02, 2015, 05:21:43 am »
Is this confirmed to be a graphics driver issue exclusively? I have multiple monitors and I get the flicker across all of them as well. Is there a workaround? My driver seems fine in every aspect and I only recently updated it (I have an AMD Radeon HD 7700). It happens if I create a rendertexture on fullscreen mode or Style::None with full resolution on my monitor.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Issue using RenderTextures on full-screen window
« Reply #5 on: July 02, 2015, 11:10:58 pm »
This isn't strictly a driver issue but a window manager issue. SFML currently creates a window along with each context and creating background windows while an SFML application is fullscreen causes flickering on some systems. This should be fixed when #885 gets merged.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).