protected void swapBuffers() { DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if (caps.isOnscreen()) { if (isNSContext) { if (!CGL.flushBuffer(contextHandle)) { throw new GLException("Error swapping buffers (NS)"); } } else { if (CGL.kCGLNoError != CGL.CGLFlushDrawable(contextHandle)) { throw new GLException("Error swapping buffers (CGL)"); } } } }