Hello.
Love2D offers 2 different full screen modes. The desktop fullscreen mode uses the resolution and refresh rate of the Desktop.
But I would like to use the exclusive fullscreen mode.
How can I set the refresh rate in Love2D in exclusive mode? I tested my game on an older CRT monitor capable of 160 Hz and on a modern 4K TV, that is capable of 120 Hz in Full HD. On both, 60 Hz was automatically selected, even though much higher refresh rates are available.
Somehow the exclusive fullscreen mode doesn't make sense if you can't set the refresh rate. In every older game with exclusive fullscreen mode, you could set the resolution, color depht and refesh rate.
How to set Refresh Rate?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to set Refresh Rate?
Not sure, but it looks like that you need to change the love.run function
https://love2d.org/wiki/love.run
https://love2d.org/wiki/love.run
Re: How to set Refresh Rate?
Thanks for your answer, but I don't want to change the game speed / FPS, ticks etc, I want my game to run at a set resolution and screen refresh rate (Hz) in exclusive fullscreen mode.darkfrei wrote: ↑Sat Nov 13, 2021 9:51 am Not sure, but it looks like that you need to change the love.run function
https://love2d.org/wiki/love.run
Re: How to set Refresh Rate?
Hm, for me I can select a refresh rate of 60 or 75 with xrandr, and it affects the whole desktop, it's not just a fullscreen thing. So it's probably OS specific. Apparently SDL supports changing the refresh rate: https://wiki.libsdl.org/SDL_DisplayMode mentions a refresh rate field, but this functionality is not exposed to Löve. I guess that's material for a feature request.
Re: How to set Refresh Rate?
Thanks for your answer. Then I don't understand the point of the "exclusive" fullscreen mode in Love2D.
Re: How to set Refresh Rate?
"desktop" creates a screen-sized borderless window and doesn't change the video mode. "exclusive" allows you to change the video mode and use different resolutions.
Re: How to set Refresh Rate?
Take into account that Löve versions before 0.9 used SDL 1, which to my knowledge doesn't support different refresh rates. Apparently no one before you has asked about that feature.
I've checked and indeed, in my system this LuaJIT program shows the 75 Hz modes:
(for Windows you may need to change .so to .dll, and for Mac to .dylib or something).
Output in my system:
I haven't tried to actually change it, but that shows that SDL2 does support it, therefore it should be possible.
Edit: I've tried using Löve to change to exclusive fullscreen mode and print the FPS. As you can see in the list above, the only available frequency in my monitor for 1152x864 is 75 Hz. If I set the 1152x864 mode, indeed the display rate is 75 Hz, but if I request any other, Löve apparently falls back to 60 Hz (the default for the desktop). If I change my desktop to a 75 Hz mode, Löve only selects 75 Hz modes in fullscreen. So yes, I think there's solid ground for a feature request to change the refresh rate.
I've checked and indeed, in my system this LuaJIT program shows the 75 Hz modes:
Code: Select all
local ffi = require'ffi'
local sdl = ffi.load'libSDL2.so'
assert(sdl)
ffi.cdef[[
int SDL_Init(uint32_t flags);
int SDL_GetNumDisplayModes(int disp);
typedef struct {
uint32_t format;
int w;
int h;
int refresh_rate;
void *driverdata;
} SDL_DisplayMode;
int SDL_GetDisplayMode(int disp, int modenum, SDL_DisplayMode *mode);
void SDL_Quit(void);
]]
assert(sdl.SDL_GetDisplayMode)
local z = ffi.new[[ SDL_DisplayMode[1] ]]
z[0].format = 0
z[0].w = 0
z[0].h = 0
z[0].refresh_rate = 0
z[0].driverdata = nil
local SDL_INIT_VIDEO = 0x20
if not love then sdl.SDL_Init(SDL_INIT_VIDEO) end
local nModes = sdl.SDL_GetNumDisplayModes(0)
for i = 0, nModes - 1 do
local R = sdl.SDL_GetDisplayMode(0, i, z)
print(z[0].w, z[0].h, z[0].refresh_rate)
end
if love then
return love.event.quit()
else
sdl.SDL_Quit()
end
Output in my system:
Code: Select all
1280 1024 75
1280 1024 60
1152 864 75
1024 768 75
1024 768 70
1024 768 60
800 600 75
800 600 72
800 600 60
800 600 56
640 480 75
640 480 73
640 480 60
Edit: I've tried using Löve to change to exclusive fullscreen mode and print the FPS. As you can see in the list above, the only available frequency in my monitor for 1152x864 is 75 Hz. If I set the 1152x864 mode, indeed the display rate is 75 Hz, but if I request any other, Löve apparently falls back to 60 Hz (the default for the desktop). If I change my desktop to a 75 Hz mode, Löve only selects 75 Hz modes in fullscreen. So yes, I think there's solid ground for a feature request to change the refresh rate.
Who is online
Users browsing this forum: Google [Bot] and 215 guests