if (!ctx) {
- NSOpenGLPixelFormatAttribute attrs[] = {
- NSOpenGLPFADoubleBuffer,
- NSOpenGLPFAColorSize, 24,
- NSOpenGLPFAAlphaSize, 8,
- NSOpenGLPFADepthSize, 16,
- 0 };
+ NSOpenGLPixelFormatAttribute attrs[20];
+ int i = 0;
+ attrs[i++] = NSOpenGLPFAColorSize; attrs[i++] = 24;
+ attrs[i++] = NSOpenGLPFAAlphaSize; attrs[i++] = 8;
+ attrs[i++] = NSOpenGLPFADepthSize; attrs[i++] = 16;
+
+ if (get_boolean_resource (mi->dpy, "doubleBuffer", "DoubleBuffer"))
+ attrs[i++] = NSOpenGLPFADoubleBuffer;
+
+ attrs[i] = 0;
+
NSOpenGLPixelFormat *pixfmt = [[NSOpenGLPixelFormat alloc]
initWithAttributes:attrs];
// Sync refreshes to the vertical blanking interval
GLint r = 1;
[ctx setValues:&r forParameter:NSOpenGLCPSwapInterval];
+ check_gl_error ("NSOpenGLCPSwapInterval");
[ctx makeCurrentContext];
check_gl_error ("makeCurrentContext");
}
}
-
// Caller expects a pointer to an opaque struct... which it dereferences.
// Don't ask me, it's historical...
static int blort = -1;