summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorquilloss <quilloss@users.noreply.github.com>2016-06-26 19:08:24 +0800
committerwm4 <wm4@nowhere>2016-06-26 13:17:39 +0200
commit24478a8a72b17d54346fb8d648e53448c3819e9d (patch)
tree0e1079c5ca07ae5e496fb6be0c8cd4108654c043
parente081e4695097ad2769510b639412adfcfe6896c5 (diff)
downloadmpv-24478a8a72b17d54346fb8d648e53448c3819e9d.tar.bz2
mpv-24478a8a72b17d54346fb8d648e53448c3819e9d.tar.xz
vo_opengl utils: use gl->main_fb when reading window content
The main framebuffer is not the default framebuffer for the dxinterop backend. Bind the main framebuffer and use the appropriate attachment when reading the window content. Fix #3284
-rw-r--r--video/out/opengl/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c
index 73b411e66c..8ddae33d8f 100644
--- a/video/out/opengl/utils.c
+++ b/video/out/opengl/utils.c
@@ -109,8 +109,10 @@ mp_image_t *gl_read_window_contents(GL *gl)
mp_image_t *image = mp_image_alloc(IMGFMT_RGB24, vp[2], vp[3]);
if (!image)
return NULL;
+ gl->BindFramebuffer(GL_FRAMEBUFFER, gl->main_fb);
+ GLenum obj = gl->main_fb ? GL_COLOR_ATTACHMENT0 : GL_FRONT;
gl->PixelStorei(GL_PACK_ALIGNMENT, 1);
- gl->ReadBuffer(GL_FRONT);
+ gl->ReadBuffer(obj);
//flip image while reading (and also avoid stride-related trouble)
for (int y = 0; y < vp[3]; y++) {
gl->ReadPixels(vp[0], vp[1] + vp[3] - y - 1, vp[2], 1,
@@ -118,6 +120,7 @@ mp_image_t *gl_read_window_contents(GL *gl)
image->planes[0] + y * image->stride[0]);
}
gl->PixelStorei(GL_PACK_ALIGNMENT, 4);
+ gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
return image;
}