57.5 fps

I haven't done any serious research into this .. (at least from a coding POV).
Thanks to gm_mathew's suggestion, I tried just making a custom a custom refresh rate for my screen of 57.5 fps, and running supermodel with that .. and well it works flawlessly. Actually I didn't even know this was possible, since I have a nothing special 1080p panel. So we can set the screen refresh rate, turn off throttle, and just let v-sync do it's thing.
I was wondering whether this was possible to just automatically set in supermodel itself, and it turns out yes we can do this.
The windows API itself kind of assumes integer refresh rates, 50, 60 etc. But if you create a custom one and set say 57.54 etc it does actually work at that speed. I think windows just rounds the refresh rate to the nearest whole number, at least with regards to what it displays in the API.
Anyway messing around with this code .. for windowed mode. This will automatically say 57.5 fps upon start up, and then revert to 60 or whatever the refresh rate was when the app ends.
We can do this in SDL too. But .. I think only in fullscreen mode. SDL is setting up an opengl window using something called exclusive mode, in short it creates a window then sets the monitors resolution refresh rate etc. I personally prefer fullscreen borderless .. but I am not sure that works with setting custom refresh rates in SDL.
Code is something like this
Any thoughts?
Thanks to gm_mathew's suggestion, I tried just making a custom a custom refresh rate for my screen of 57.5 fps, and running supermodel with that .. and well it works flawlessly. Actually I didn't even know this was possible, since I have a nothing special 1080p panel. So we can set the screen refresh rate, turn off throttle, and just let v-sync do it's thing.
I was wondering whether this was possible to just automatically set in supermodel itself, and it turns out yes we can do this.
The windows API itself kind of assumes integer refresh rates, 50, 60 etc. But if you create a custom one and set say 57.54 etc it does actually work at that speed. I think windows just rounds the refresh rate to the nearest whole number, at least with regards to what it displays in the API.
Anyway messing around with this code .. for windowed mode. This will automatically say 57.5 fps upon start up, and then revert to 60 or whatever the refresh rate was when the app ends.
- Code: Select all
void EnumDisplayDevicesSuper()
{
DEVMODE currentSettings = { 0 };
EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, ¤tSettings);
for (int i = 0; ; i++) {
DEVMODE settings = { 0 };
BOOL success = EnumDisplaySettings(nullptr, i, &settings);
if (!success) {
break;
}
if (settings.dmPelsWidth == currentSettings.dmPelsWidth &&
settings.dmPelsHeight == currentSettings.dmPelsHeight &&
settings.dmDisplayFrequency == 58) {
settings.dmFields = DM_DISPLAYFREQUENCY;
auto retVal = ChangeDisplaySettings(&settings, 0);
int debug = 0;
}
printf("settings %i %i %i\n", settings.dmPelsWidth, settings.dmPelsHeight, settings.dmDisplayFrequency);
}
}
We can do this in SDL too. But .. I think only in fullscreen mode. SDL is setting up an opengl window using something called exclusive mode, in short it creates a window then sets the monitors resolution refresh rate etc. I personally prefer fullscreen borderless .. but I am not sure that works with setting custom refresh rates in SDL.
Code is something like this
- Code: Select all
int Test()
{
static int display_in_use = 0; /* Only using first display */
int i, display_mode_count;
SDL_DisplayMode mode;
Uint32 f;
printf("SDL_GetNumVideoDisplays(): %i\n", SDL_GetNumVideoDisplays());
display_mode_count = SDL_GetNumDisplayModes(display_in_use);
if (display_mode_count < 1) {
printf("SDL_GetNumDisplayModes failed: %s\n", SDL_GetError());
return 1;
}
printf("SDL_GetNumDisplayModes: %i", display_mode_count);
for (i = 0; i < display_mode_count; ++i) {
if (SDL_GetDisplayMode(display_in_use, i, &mode) != 0) {
printf("SDL_GetDisplayMode failed: %s\n", SDL_GetError());
return 1;
}
f = mode.format;
printf("Mode %i\tbpp %i\t%s\t%i x %i %i\n",
i, SDL_BITSPERPIXEL(f),
SDL_GetPixelFormatName(f),
mode.w, mode.h, mode.refresh_rate);
if (mode.refresh_rate == 58) {
auto result = SDL_SetWindowDisplayMode(s_window, &mode);
int debug = 0;
}
}
//SDL_SetWindowDisplayMode
}
Any thoughts?
