Automatic vsync under Win32 when using a double-buffer?

Hi,

When using the PFD_DOUBLEBUFFER flag in my Windows application, the fps is equivalent to the refresh rate of my monitor; 60Hz yields 60fps, 75 Hz yields 75fps and so on. (ie. it seems to wait for a VBL before swapping the buffers).

Does anyone know if this vsync feature is part of my graphics-driver or part of Microsoft’s implementation of OpenGL?

No, this only happens if you have v-sync enabled, it does not have anything to do with double buffering.
It is also not driver or microsoft specific as this works the same way on all systems.

Ok, but if I don’t use the double-buffer flag, I get way above 5000 fps and a constant CPU usage of 100%!?

that’s because it only works during double buffering because when you use single buffering you draw directly to the front buffer.

I tried to test the program on my brothers computer. His monitor runs at 60Hz, but I got 210fps, so obviously the fps-rate doesn’t automatically adjust to the frequency when db is enabled. However, he has vsync disabled, which, as you (zeoverlord) suggested, is why the two numbers don’t match :wink:

However, I am a little confused about what you meant when you said “it does not have anything to do with double buffering”, and in you next post stated “that’s because it only works during double buffering” … ?

Thanks for your replies.