diff --git a/Demos/OpenGL/GlutStuff.cpp b/Demos/OpenGL/GlutStuff.cpp index 867e1e150..d8de3e726 100644 --- a/Demos/OpenGL/GlutStuff.cpp +++ b/Demos/OpenGL/GlutStuff.cpp @@ -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; diff --git a/Demos/OpenGL/GlutStuff.h b/Demos/OpenGL/GlutStuff.h index c518bf208..10d357641 100644 --- a/Demos/OpenGL/GlutStuff.h +++ b/Demos/OpenGL/GlutStuff.h @@ -21,6 +21,7 @@ subject to the following restrictions: //think different #if defined(__APPLE__) && !defined (VMDMESA) +#include #include #include #include