detecting a refresh rate in opengl

I am currently writing a program for a professor at Indiana University ( I am an undergraduate psychology major there). This program simply alternates between two white and black rectangles. However to make these ocellate correctly, I need to have the program find the monitor’s refresh rate. Is there a way of doing this in either C or OpenGl? Thanks for your help.

AFAIK this is OS specific information
glut has a command glutGameModeGet(GLUT_GAME_MODE_REFRESH_RATE) but i think this only works if youre in glut game mode to begin with

Could you tell me either where I can get information on getting the refresh rate in windows or simply post it yourself (if you know)? Thanks.

Have a look at the drawsprocket toolkit, pretty sure you can do it on that

gav

BOOL EnumDisplaySettings(
LPCTSTR lpszDeviceName, // display device
DWORD iModeNum, // graphics mode
LPDEVMODE lpDevMode // graphics mode settings
);

  • in lpDevMode theres a var called dmDisplayFrequency
    have a look in windopws halp 4 a more detailed information

Well, I have tried this and the refresh rate always is 0. In another example I saw it checked it and set it to 60 if it was 0.

I also did this.

This is another proiblem with the windows version of OpenGL.

Luke.

In what way is this an OpenGL problem?

The refresh rate is a problem for the functions dealing with setting displaymode, and that has nothing to do with OpenGL. OpenGL starts when the display/window is ready for rendering.