add vsync for Mac OSX to avoid tearing artifacts
This commit is contained in:
@@ -101,6 +101,16 @@ int glutmain(int argc, char **argv,int width,int height,const char* title,DemoAp
|
|||||||
glutDisplayFunc( glutDisplayCallback );
|
glutDisplayFunc( glutDisplayCallback );
|
||||||
|
|
||||||
glutMoveAndDisplayCallback();
|
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();
|
glutMainLoop();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
//think different
|
//think different
|
||||||
#if defined(__APPLE__) && !defined (VMDMESA)
|
#if defined(__APPLE__) && !defined (VMDMESA)
|
||||||
|
#include <OpenGL/OpenGL.h>
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
#include <OpenGL/glu.h>
|
#include <OpenGL/glu.h>
|
||||||
#include <GLUT/glut.h>
|
#include <GLUT/glut.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user