Skip to content

Instantly share code, notes, and snippets.

@daltondotgd
Created August 27, 2014 18:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save daltondotgd/8023c14fc77a911e2d34 to your computer and use it in GitHub Desktop.
Save daltondotgd/8023c14fc77a911e2d34 to your computer and use it in GitHub Desktop.
To enable VSync for WIN32 in cocos2d-x, modify initWithRect(...) function in CCGLView.cpp, so it contains this code right before 'initGlew();'
...
...
...
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Turn on vertical screen sync under Windows.
// (I.e. it uses the WGL_EXT_swap_control extension)
typedef BOOL(WINAPI *PFNWGLSWAPINTERVALEXTPROC)(int interval);
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
if (wglSwapIntervalEXT)
wglSwapIntervalEXT(1);
#endif
initGlew(); // this already exists int the file
...
...
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment