diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-03-22 15:57:29 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-03-22 15:57:29 +0100 |
commit | af2a21176736a9f9ad8a1c7fa458a598262b703e (patch) | |
tree | 08261f1faf31285510fca0080c34b2ab918a251d /src | |
parent | 76dc50e86288c5d21ba8145c256e8d5d9d196360 (diff) |
Fix resize to fullscreen black video
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 14 |
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"); } |