CGL vs. AGL
Here's the problem, I tried switching to a CGL only OpenGL context, instead of using AGL.
Now I get really bad tearing across the screen.
Here is some code for getting the context (I've tried this with and without vsync).
And draw the screen.
It tears, um, terribly.
Now I get really bad tearing across the screen.
Here is some code for getting the context (I've tried this with and without vsync).
Code:
CGLContextObj SetupCGL(void)
{
CGDisplayCapture(kCGDirectMainDisplay);
CGOpenGLDisplayMask displayMask =
CGDisplayIDToOpenGLDisplayMask( kCGDirectMainDisplay ) ;
CGLPixelFormatAttribute attribs[] =
{
kCGLPFAFullScreen,
kCGLPFADisplayMask,
kCGLPFADoubleBuffer,
(CGLPixelFormatAttribute)displayMask,
(CGLPixelFormatAttribute)NULL
} ;
CGLPixelFormatObj pixelFormatObj ;
long numPixelFormats ;
CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );
CGLContextObj contextObj ;
CGLCreateContext( pixelFormatObj, NULL, &contextObj ) ;
CGLDestroyPixelFormat( pixelFormatObj ) ;
long swapInterval = 1 ;
CGLSetParameter( contextObj, kCGLCPSwapInterval, &swapInterval ) ;
CGLSetCurrentContext( contextObj ) ;
CGLSetFullScreen( contextObj ) ;
return contextObj;
}And draw the screen.
Code:
void DoAnimate (void)
{
CalculateMicroseconds();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
SFAnimateWorld(); // make opengl calls
CGLFlushDrawable( gOpenGLContext );
}It tears, um, terribly.
stinware.com where games are friends.
Your pixel format attributes are in the wrong order. You've set your display mask to "double buffer", so you're getting a single-buffered fullscreen display, which will tear like crazy.

