return program;
}
+unsigned create_2d_texture()
+{
+ unsigned texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ return texture;
+}
+
int create_gl_resources(Compositor *compositor, CompositedScreen *screen)
{
unsigned stride;
glBindBuffer(GL_ARRAY_BUFFER, 0);
- glGenTextures(1, &screen->fb_texture);
- glBindTexture(GL_TEXTURE_2D, screen->fb_texture);
+ screen->fb_texture = create_2d_texture();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, screen->width, screen->height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindTexture(GL_TEXTURE_2D, 0);
glGenFramebuffers(1, &screen->framebuffer);
if(window->map_state==IsViewable)
create_window_pixmap(compositor, screen, window);
- glGenTextures(1, &window->texture);
- glBindTexture(GL_TEXTURE_2D, window->texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ window->texture = create_2d_texture();
return window;
}
if(window->map_state!=IsViewable)
continue;
+ XDamageSubtract(compositor->display, window->damage, None, None);
+
glBindTexture(GL_TEXTURE_2D, window->texture);
compositor->glXBindTexImageEXT(compositor->display, window->glx_pixmap, GLX_FRONT_LEFT_EXT, NULL);
glUniform4f(screen->geometry_loc,
- (float)window->x/screen->width, ((float)screen->height-window->y-window->height)/screen->height,
+ (float)window->x/screen->width, 1.0f-(float)(window->y+window->height)/screen->height,
(float)(window->width+2*window->border)/screen->width, (float)(window->height+2*window->border)/screen->height);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
compositor->glXReleaseTexImageEXT(compositor->display, window->glx_pixmap, GLX_FRONT_LEFT_EXT);
- XDamageSubtract(compositor->display, window->damage, None, None);
}
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
continue;
glUniform4f(screen->geometry_loc,
- (float)monitor->x/screen->width, ((float)screen->height-monitor->y-monitor->height)/screen->height,
+ (float)monitor->x/screen->width, 1.0f-(float)(monitor->y+monitor->height)/screen->height,
(float)monitor->width/screen->width, (float)monitor->height/screen->height);
glBindVertexArray(monitor->vertex_array);