+
+#ifdef USE_GL
+void gl_paint(Window win, Appearance *l)
+{
+ int err;
+ Window root, child;
+ int i, transferred = 0, sw, b, d;
+ pixel32 *source, *dest;
+ Pixmap oldp;
+ int tempx, tempy, absx, absy, absw, absh;
+ int x = l->area.x;
+ int y = l->area.y;
+ int w = l->area.width;
+ int h = l->area.height;
+ Rect tarea; /* area in which to draw textures */
+ if (w <= 0 || h <= 0 || x+w <= 0 || y+h <= 0) return;
+
+ g_assert(l->surface.type == Surface_Planar);
+
+printf("making %p, %p, %p current\n", ob_display, win, render_glx_context);
+ err = glXMakeCurrent(ob_display, win, render_glx_context);
+g_assert(err != 0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, 1376, 1032, 0, 0, 10);
+ if (XGetGeometry(ob_display, win, &root, &tempx, &tempy,
+ &absw, &absh, &b, &d) &&
+ XTranslateCoordinates(ob_display, win, root, tempx, tempy,
+ &absx, &absy, &child))
+ printf("window at %d, %d (%d,%d)\n", absx, absy, absw, absh);
+ else
+ return;
+
+ glViewport(0, 0, 1376, 1032);
+ glMatrixMode(GL_MODELVIEW);
+ glTranslatef(-absx, 1032-absh-absy, 0);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+
+ if (l->surface.data.planar.grad == Background_ParentRelative) {
+ printf("crap\n");
+ } else
+ render_gl_gradient(&l->surface, absx+x, absy+y, absw, absh);
+
+ glXSwapBuffers(ob_display, win);
+}
+
+#endif /* USE_GL */