Added in double buffering and added in the capability to actually swapBuffers with CGFlushDisplay() which will copy the back to the front.

This commit is contained in:
Gregory Pierce 2003-05-10 22:02:19 +00:00
parent 2eccb0f4ce
commit 8ae528efe0
1 changed files with 7 additions and 1 deletions

View File

@ -68,14 +68,19 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
CGDisplaySwitchToMode( displayID, displayMode ); CGDisplaySwitchToMode( displayID, displayMode );
CGLPixelFormatAttribute attribs[2]; CGLPixelFormatAttribute attribs[2];
long swapInterval;
attribs[0] = kCGLPFAFullScreen; attribs[0] = kCGLPFAFullScreen;
attribs[1] = NULL; attribs[1] = kCGLPFADoubleBuffer;
CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats ); CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );
if ( pixelFormatObj != NULL ) if ( pixelFormatObj != NULL )
{ {
CGLCreateContext( pixelFormatObj, NULL, &contextObj ); CGLCreateContext( pixelFormatObj, NULL, &contextObj );
CGLDestroyPixelFormat( pixelFormatObj ); CGLDestroyPixelFormat( pixelFormatObj );
swapInterval = 1;
CGLSetParameter( contextObj, kCGLCPSwapInterval, &swapInterval );
} }
CGLSetCurrentContext( contextObj ); CGLSetCurrentContext( contextObj );
@ -108,6 +113,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroyGL
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers
(JNIEnv *, jobject) (JNIEnv *, jobject)
{ {
CGLFlushDrawable( contextObj );
} }