]> icculus.org git repositories - dana/openbox.git/blob - render2/instance.c
add a new render2 lib, which has a proper API and uses only OpenGL to render.
[dana/openbox.git] / render2 / instance.c
1 #include "instance.h"
2 #include <glib.h>
3
4 struct RrInstance *RrInstanceNew(Display *display,
5                                  int screen,
6                                  XVisualInfo visinfo)
7 {
8     struct RrInstance *inst;
9
10     inst = g_new(struct RrInstance, 1);
11     inst->display = display;
12     inst->screen = screen;
13     inst->visinfo = visinfo;
14     inst->cmap = XCreateColormap(display, RootWindow(display, screen),
15                                  RrVisual(inst), AllocNone);
16     inst->glx_context = glXCreateContext(display, &visinfo, NULL, TRUE);
17
18     g_assert(inst->glx_context);
19
20     return inst;
21 }
22
23 void RrInstanceFree(struct RrInstance *inst)
24 {
25     if (inst) {
26         glXDestroyContext(inst->display, inst->glx_context);
27         XFreeColormap(inst->display, inst->cmap);
28         g_free(inst);
29     }
30 }