View Full Version : How to use wglSwapBuffers?
12-23-2006, 05:11 AM
I want to use wglSwapBuffers in my examples-- I have seen this function in the book "More OpenGL Game Programming".However I have not found this function in wglext.h( or wglew.h ).I have seen a similar function called wglSwapBuffersMscOML() however. How to disable VSYNC with these functions?
12-23-2006, 09:48 AM
1.) There is a Win32 API function wglSwapLayerBuffers().
The SwapBuffers() function you might know is just a wrapper on top of this. SwapBuffers() swaps all color buffers from back to front.
With wglSwapLayerBuffers() you can swap mainplane and overlay plane independently. That is, if your OpenGL implementation supports overlays and you use them.
If not, SwapBuffers() is the same as wglSwapLayerBuffers(hdc, WGL_SWAP_MAIN_PLANE).
2.) Waiting for vertical retrace is not controlled with these functions but with the extension http://www.opengl.org/registry/specs/EXT/wgl_swap_control.txt
If your OpenGL implementaton supports this and returns a valid function pointer for it, call wglSwapIntervalEXT(0) and both of the above mentioned swap buffer calls should stop waiting on the next vsync.
In most graphics drivers there is a setting in their control panels which can be used to ovveride this.
12-23-2006, 08:02 PM
There is wglSwapBuffers and wglSwapLayerBuffers and wglSwapMultipleBuffers which is standard on all Windows. It's not recommended to use these because it causes some weird behavior/performance loss.
Only use SwapBuffers(HDC hdc)
wglSwapBuffers is suppose to do the same thing, but it's not recommended.
Some of those wgl functions are defined in wingdi.h
12-24-2006, 03:25 AM
With wglSwapLayerBuffers() and wglSwapIntervalEXT(0) I disabled VSYNC--It's an option in our game.
12-24-2006, 06:10 PM
You only need wglSwapIntervalEXT to control v-sync
wglSwapIntervalEXT(0) = off
wglSwapIntervalEXT(1) = on
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.