How to get screen refresh rate?

Is it possible? Since ive noticed that v-sync does not work at all on my laptop, so I create the FPS limiter β€œmanually”, and now I would like to use the FPS restriction that the user set on his screen.

Edit: I mean the speed of the hz monitor.

Edit3: heres the code I was working in (think ... is something wrong?):

DEVMODE lpDevMode; memset(&lpDevMode, 0, sizeof(DEVMODE)); lpDevMode.dmSize = sizeof(DEVMODE); lpDevMode.dmDriverExtra = 0; if(EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode) == 0){ framerate_limit = 60; // default value if cannot retrieve from user settings. } 

Upon request, here is my v-sync activation code jay.lee asked:

 PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; // global ... wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT"); v_sync_enabled = 0; if(wglSwapIntervalEXT != NULL){ if(wglSwapIntervalEXT(1) != FALSE){ v_sync_enabled = 1; } } 
+4
source share
1 answer

The Win32 EnumDisplaySettings function may be what you are looking for. The refresh rate is stored in lpDevMode->dmDisplayFrequency .

+6
source

All Articles