+ /* Create context */
+ NSOpenGLPixelFormatAttribute attribs[] = {
+ NSOpenGLPFAColorSize, 24,
+ NSOpenGLPFAAlphaSize, 8,
+ NSOpenGLPFADepthSize, 1,
+ NSOpenGLPFADoubleBuffer,
+ 0
+ };
+ NSOpenGLPixelFormat *pix = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
+ NSOpenGLContext *ctx = [[NSOpenGLContext alloc] initWithFormat:pix shareContext:nil];
+
+ /* Disable GTK double buffering */
+ gtk_widget_set_double_buffered(widget, FALSE);
+
+ return ctx;
+}
+gboolean configure(GtkWidget *widget, GdkEventConfigure *event, NSOpenGLContext *ctx)
+{
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(widget, &alloc);
+
+ GdkWindow *win = gtk_widget_get_window(widget);
+ NSView *view = gdk_quartz_window_get_nsview(win);
+ NSRect rect = NSMakeRect(alloc.x, alloc.y, alloc.width, alloc.height);
+
+ [view setFrame:rect];
+ [ctx update];