Page 1 of 1

Hello world text flickering on fullscreen window

Posted: Thu Nov 20, 2014 5:16 pm
by vitto
I'm trying to create my first Hello world window but I see the text flickering only if the window is set to Fullscreen mode, where I'm wrong?

I have a MacBook Air 2011 with a screen resolution of 1440 x 900 pixels

Code: Select all

function love.draw()

    love.graphics.print('hey that\'s flickering!', 50, 50)
    
    success = love.window.setMode(1440, 900, {
        display        = 1,
        fullscreen     = true,
        centered       = true,
        fullscreentype = "normal",
        resizable      = false,
        borderless     = true,
        highdpi        = true,
        vsync          = false,
        fsaa           = 0,
        srgb           = false,
        minwidth       = 640,
        minheight      = 480
    })

end
I't seems like something is refreshing the contents constantly, I'm not sure where I'm wrong, can you help me?

:roll:

Re: Hello world text flickering on fullscreen window

Posted: Thu Nov 20, 2014 6:44 pm
by bartbes
vitto wrote: I't seems like something is refreshing the contents constantly
Yes, you are!
Regardless of the fact that the screen is always constantly redrawn, your code is recreating the window every single frame. You see, love.window.setMode recreates a bunch of stuff to make sure it all works with the new settings, and this is generally quite slow. Even if fast, I imagine the flickering you're seeing is the constant switching between fullscreen modes (or a fullscreen window and nothing, even).

The solution: move the call to love.graphics.setMode to love.load, or, even nicer, if you apply the settings in conf.lua instead, the initially created window will already have those settings.

Re: Hello world text flickering on fullscreen window

Posted: Thu Nov 20, 2014 6:49 pm
by vitto
Thank you, if you say that I suppose event handling is one of the first things I should read on documentation.

Now it's more clear why it's flickering!

bye

:ultraglee: