[glfw-dev] problem with GLFW_REFRESH_RATE

nobody wrote on Sunday, July 30, 2006:


I try to use glfwOpenWindowHint(GLFW_REFRESH_RATE, X); without success (under Windows). On the “win32_fullscreen.c” I found the code it change the display mode and probably the refresh rate. I can’t understand how it work. When _glfwWin.DesiredRefreshRate is > 0 the flag DISPLAYFREQUENCY is added. But the dm.dmDisplayFrequency is not set before the ChangeDisplaySettings, it’s a error ?
(I think we must add “dm.dmDisplayFrequency=_glfwWin.DesiredRefreshRate” before the ChangeDisplaySettings)

Thanks if you can help me,

Jérôme Cayet

// _glfwSetVideoModeMODE() - Change the current video mode

void _glfwSetVideoModeMODE( int mode )
int success;

// Get the parameters for the best matching display mode
dm.dmSize = sizeof\( DEVMODE \);
\(void\) EnumDisplaySettings\( NULL, mode, &dm \);

// Set which fields we want to specify

// Do we have a prefered refresh rate?
if\( \_glfwWin.DesiredRefreshRate > 0 \)
    dm.dmFields = dm.dmFields | DM\_DISPLAYFREQUENCY;

// Change display setting
dm.dmSize = sizeof\( DEVMODE \);
success = ChangeDisplaySettings\( &dm, CDS\_FULLSCREEN \);

// If the mode change was not possible, query the current display
// settings \(we'll use the desktop resolution for fullscreen mode\)
if\( success == DISP\_CHANGE\_SUCCESSFUL \)
    \_glfwWin.ModeID = mode;
    \_glfwWin.ModeID = ENUM\_REGISTRY\_SETTINGS;
    EnumDisplaySettings\( NULL, ENUM\_REGISTRY\_SETTINGS, &dm \);

// Set the window size to that of the display mode
\_glfwWin.Width  = dm.dmPelsWidth;
\_glfwWin.Height = dm.dmPelsHeight;


elmindreda wrote on Wednesday, August 16, 2006:

You are quite right. That’s a bug. A fix has been committed to CVS, and should be included in the next release.

I can’t see that it’s ever been correct in the CVS history. Odd that no one noticed before.