add vsync for Mac OSX to avoid tearing artifacts

This commit is contained in:
erwin.coumans
2010-03-06 19:37:38 +00:00
parent da3c174b0e
commit 3c8f8f55d7
2 changed files with 11 additions and 0 deletions

View File

@@ -101,6 +101,16 @@ int glutmain(int argc, char **argv,int width,int height,const char* title,DemoAp
glutDisplayFunc( glutDisplayCallback );
glutMoveAndDisplayCallback();
//enable vsync to avoid tearing on Apple (todo: for Windows)
#if defined(__APPLE__) && !defined (VMDMESA)
int swap_interval = 1;
CGLContextObj cgl_context = CGLGetCurrentContext();
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
#endif
glutMainLoop();
return 0;