Following up on our comments, effectively VSYNC causes blocking... but more accurately, it blocks when the swap-chain is full of back buffers that need to be swapped. Triple buffering can be used to reduce blocking in an implementation of VSYNC, but neither WGL nor GLX exposes arbitrary control over the number of back buffers in the swap-chain, so you have to modify driver settings to enable it in an OpenGL context.
In OpenGL, the GL itself does not handle buffer swaps or VSYNC as I pointed out in an earlier comment, you must use the platform-specific window system layer (e.g. WGL, GLX, AGL/CGL, EGL) to set something known as a Swap Interval.
- Setting the swap interval to 1 will enable VSYNC
Setting the swap interval to 0 will disable VSYNC
Setting the swap interval to -1 will enable adaptive VSYNC on newer drivers
Support is determined by the existence of:
WGL_EXT_swap_control_tear
(Windows)or
GLX_EXT_swap_control_tear
(Any platform that uses X11, such as Linux)
Adaptive VSYNC is an interesting new feature that blocks if your application is exceeding the display's refresh rate but allows tearing when you are under the refresh rate. This is opposed to the normal behavior where anything below the refresh rate is throttled to some lower factor of the refresh rate.
In any case, since you are using Windows in this example, you will want to look into
wglSwapIntervalEXT (...)
.