xcb_glx_get_fb_configs_cookie_t fbck;
xcb_glx_get_fb_configs_reply_t *fbrep;
xcb_depth_iterator_t depth_it;
- uint32_t fbcon = FALSE;
unsigned int i, nvprops, nfbprops;
uint32_t *vprops, *fbprops;
uint32_t db, stencil, depthsize;
vid = 0;
if (depth_it.data->depth > MAX_DEPTH) continue;
+ printf("looking for depth %d\n", depth_it.data->depth);
+
visuals = xcb_depth_visuals(depth_it.data);
nvisuals = xcb_depth_visuals_length(depth_it.data);
if (!vid) continue;
- printf("found visual for depth %d\n", i);
+ printf("found visual for depth %d\n", depth_it.data->depth);
for (k = 0; k < fbrep->num_FB_configs; ++k) {
uint32_t val;
- printf("root visual 0x%x\n", sc->super.root_visual);
- printf("overlay visual 0x%x\n", sc->overlay_visual);
+ //printf("root visual 0x%x\n", sc->super.root_visual);
+ //printf("overlay visual 0x%x\n", sc->overlay_visual);
val = glxrender_fbconfig_info(fbprops, k, nfbprops,
GLX_VISUAL_ID);
- printf("x visual 0x%x\n", val);
+ //printf("x visual 0x%x\n", val);
if (val != vid) continue;
val = glxrender_fbconfig_info(fbprops, k, nfbprops,
GLX_DOUBLEBUFFER);
- printf("dbl buffer %s\n", val ? "yes" : "no");
+ //printf("dbl buffer %s\n", val ? "yes" : "no");
if (db) continue;
val = glxrender_fbconfig_info(fbprops, k, nfbprops,
GLX_DEPTH_SIZE);
- printf("depth size %d\n", val);
+ //printf("depth size %d\n", val);
val = glxrender_fbconfig_info(fbprops, k, nfbprops,
GLX_RED_SIZE);
- printf("red size %d\n", val);
+ //printf("red size %d\n", val);
if (!val) continue;
val = glxrender_fbconfig_info(fbprops, k, nfbprops,
GLX_GREEN_SIZE);
- printf("green size %d\n", val);
+ //printf("green size %d\n", val);
if (!val) continue;
val = glxrender_fbconfig_info(fbprops, k, nfbprops,
GLX_BLUE_SIZE);
- printf("blue size %d\n", val);
+ //printf("blue size %d\n", val);
if (!val) continue;
val = glxrender_fbconfig_info(fbprops, k, nfbprops,
GLX_ALPHA_SIZE);
- printf("alpha size %d\n", val);
+ //printf("alpha size %d\n", val);
if (!val) continue;
val = glxrender_fbconfig_info(fbprops, j, nfbprops,
GLX_RENDER_TYPE);
- printf("rgba bit %s\n", val & GLX_RGBA_BIT ? "yes" : "no");
+ //printf("rgba bit %s\n", val & GLX_RGBA_BIT ? "yes" : "no");
if (!(val & GLX_RGBA_BIT)) continue;
val = glxrender_fbconfig_info(fbprops, j, nfbprops,
GLX_CONFIG_CAVEAT);
- printf("caveat 0x%x\n", val);
+ //printf("caveat 0x%x\n", val);
val = glxrender_fbconfig_info(fbprops, j, nfbprops,
GLX_BIND_TO_TEXTURE_RGBA_EXT);
- printf("bind ext %s\n", val ? "yes" : "no");
+ //printf("bind ext %s\n", val ? "yes" : "no");
if (!val) continue;
d->fbconfig[depth_it.data->depth] =
glxrender_free_window_pixmap(d_window_t *w, window_data_t *wd)
{
/* this might cause an error, oh well */
- //if (wd->picture) {
- // xcb_render_free_picture(w->sc->dpy->conn, wd->picture);
- // wd->picture = XCB_NONE;
- //}
+ if (wd->glpixmap) {
+ glBindTexture(GL_TEXTURE_2D, wd->texname);
+
+ //d->releaseTexImageEXT(obt_display, lw->glpixmap,
+ // GLX_FRONT_LEFT_EXT);
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ xcb_glx_destroy_glx_pixmap(w->sc->dpy->conn, wd->glpixmap);
+ wd->glpixmap = XCB_NONE;
+ }
}
static void
glxrender_update_window_pixmap(d_window_t *w, data_t *d, window_data_t *wd)
{
xcb_pixmap_t px;
+ uint8_t depth;
+
+ static const uint32_t attrs[] = {
+ GLX_TEXTURE_FORMAT_EXT,
+ GLX_TEXTURE_FORMAT_RGBA_EXT
+ };
px = window_get_pixmap(w);
+ depth = window_get_depth(w);
+ if (px && d->fbconfig[depth]) {
+ wd->glpixmap = xcb_generate_id(w->sc->dpy->conn);
+ xcb_glx_create_pixmap(w->sc->dpy->conn, w->sc->num, d->fbconfig[depth],
+ px, wd->glpixmap, 2, attrs);
+
+ glBindTexture(GL_TEXTURE_2D, wd->texname);
+
+ {
+ unsigned int len = 2 * sizeof(uint32_t);
+ uint32_t data[] = {wd->glpixmap, GLX_FRONT_LEFT_EXT};
+ xcb_void_cookie_t ck;
+ xcb_generic_error_t *err;
+
+ ck = xcb_glx_vendor_private(w->sc->dpy->conn,
+ GLX_BIND_TO_TEXTURE_RGBA_EXT,
+ d->context_tag,
+ len, data);
+ if ((err = xcb_request_check(w->sc->dpy->conn, ck))) {
+ display_error(w->sc->dpy, err);
+ free(err);
+ }
+ }
+ //d->bindTexImageEXT(obt_display, lw->glpixmap,
+ // GLX_FRONT_LEFT_EXT, NULL);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+ }
}
static void
data_t *d = screen_find_plugin_data(sc, plugin_id);
d_list_it_t *it;
+ printf("painting\n");
+
paint_root(sc, d);
for (it = list_bottom(sc->stacking); it; it = it->prev) {
{
//if (!d->root_picture)
glxrender_update_root_pixmap(sc, d);
+
+ glClear(GL_COLOR_BUFFER_BIT);
}
static void
paint_window(d_window_t *w, data_t *d, window_data_t *wd, gboolean opaque,
int x, int y, int width, int height, int bwidth)
{
- //if (!wd->picture)
- glxrender_update_window_pixmap(w, d, wd);
-
- //printf("-- paint window 0x%x picture 0x%x --\n", w->id, wd->picture);
-/*
- if (wd->picture) {
- xcb_render_picture_t alphamap;
- int op;
-
- if (opaque) {
- op = XCB_RENDER_PICT_OP_SRC;
- alphamap = XCB_NONE;
- }
- else {
- op = XCB_RENDER_PICT_OP_OVER;
- alphamap = wd->alpha_picture;
- }
-
- xcb_render_composite(w->sc->dpy->conn,
- op,
- wd->picture,
- alphamap,
- d->overlay_buffer,
- 0, 0, 0, 0,
- x, y, width + bwidth*2, height + bwidth *2);
- }
-*/
+ if (!wd->glpixmap)
+ glxrender_update_window_pixmap(w, d, wd);
+
+ glBegin(GL_QUADS);
+ glColor3f(1.0, 1.0, 1.0);
+ glVertex2i(x, y);
+ glTexCoord2f(1, 0);
+ glVertex2i(x + width + bwidth, y);
+ glTexCoord2f(1, 1);
+ glVertex2i(x + width + bwidth,
+ y + height + bwidth);
+ glTexCoord2f(0, 1);
+ glVertex2i(x, y + height + bwidth);
+ glTexCoord2f(0, 0);
+ glEnd();
}
static void