aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 689eeb6..df7b28d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -242,9 +242,6 @@ static bool recreate_window_pixmap(Display *dpy, Window window_id,
// glEnable(GL_BLEND);
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- pixmap.texture_width = attr.width;
- pixmap.texture_height = attr.height;
-
glXBindTexImageEXT(dpy, pixmap.glx_pixmap, GLX_FRONT_EXT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST); // GL_LINEAR );
@@ -252,9 +249,14 @@ static bool recreate_window_pixmap(Display *dpy, Window window_id,
GL_NEAREST); // GL_LINEAR);//GL_LINEAR_MIPMAP_LINEAR );
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- GLint gl_texture_width = 0;
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &gl_texture_width);
- if(gl_texture_width == 0) {
+ glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH,
+ &pixmap.texture_width);
+ glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT,
+ &pixmap.texture_height);
+
+ if(pixmap.texture_width == 0 || pixmap.texture_height == 0) {
+ pixmap.texture_width = attr.width;
+ pixmap.texture_height = attr.height;
fprintf(stderr, "Warning: failed to get texture size. You are probably running an unsupported compositor and recording the selected window doesn't work at the moment. A black window will be displayed instead\n");
}