FPS - how to manage them and

Hello everyone. I’m a newbie but 2 questions already raised.

  1. Is there a way to set monitor’s refresh rate while running a fullscren OpenGL app.

  2. Is there a way to synchronize buffer swapping in a double bufferd app with monitor’s vertical refresh. Specifically I need something similar to the asynchroneous Direct Draw Flip() method. I’m pasting MSDN snippet to make things clearer:

"When working with visible surfaces, such as a primary surface flipping chain or a visible overlay surface flipping chain, the Flip method is asynchronous unless you include the DDFLIP_WAIT flag. On these visible surfaces, the Flip method can return before the actual flip operation occurs in the hardware (because the hardware doesn’t flip until the next vertical refresh occurs). While the actual flip operation is pending, the back buffer behind the currently visible surface can’t be locked or blitted by calling the IDirectDrawSurface7::Lock, IDirectDrawSurface7::Blt, IDirectDrawSurface7::BltFast, or IDirectDrawSurface7::GetDC methods. If you attempt to call these methods while a flip operation is pending, they will fail and return DDERR_WASSTILLDRAWING. "

Something like that in OpenGL? Thanks.

Originally posted by <Mitko>:

2. Is there a way to synchronize buffer swapping in a double bufferd app with monitor’s vertical refresh. Specifically I need something similar to the asynchroneous Direct Draw Flip() method. I’m pasting MSDN snippet to make things clearer:

Thanks.

Do you want to synchronize or not to ? synchrone or asynchrone in fact…

There’s a quiete recent topic about that if vertical synchronization is what you look for.

http://www.gamedev-bg.net/phpBB2/viewtopic.php?t=390

Things like refresh rate/display resolution/etc are not in OpenGL’s competence. Unlike as is in the microsoft’s world, here the things are separated (this is the unix model). In particular OpenGL does not know anything about these things. It even does know about how windows are created and managed. It’s area of power is strictly the drawing of 3d graphics to some abstract framebuffer (which could happen to be a window). The linkage between OpenGL and the particular window system is usually performed by some auxiliary intermediate API (as is the GLX for the X windows system).

So if you want to do things like managing refresh rate, you should look for some other window-system specific API. Under X it is the XF86VidMode extension (and probably the new RandR extension too, but it’s still unstable). (Don’t get confused, these are NOT OpenGL extensions. They are extensions to the X window system API as is the GLX itself). Under windows you could use ChangeDisplaySettings(Ex) function.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.