summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-06-18 15:16:29 +0200
committerwm4 <wm4@nowhere>2016-06-18 15:16:29 +0200
commit4a15bc6d737a34d232675ee6078813a84efe4d9c (patch)
tree79900e4fd903e3c9b1dc4b27918c2a724d4589d6 /video/out/opengl/video.c
parent9215a9e59889c7a2f600c618501ace1360bf810d (diff)
downloadmpv-4a15bc6d737a34d232675ee6078813a84efe4d9c.tar.bz2
mpv-4a15bc6d737a34d232675ee6078813a84efe4d9c.tar.xz
vo_opengl: add ability to render to an arbitrary backing framebuffer
Most of the functionality already exists for the sake of vo_opengl_cb. We only have to use it. This will be used by dxinterop in the following commit.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r--video/out/opengl/video.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 0bbc979476..6282d296cc 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -3342,7 +3342,12 @@ static void init_gl(struct gl_video *p)
}
if ((gl->es >= 300 || gl->version) && (gl->mpgl_caps & MPGL_CAP_FB)) {
+ gl->BindFramebuffer(GL_FRAMEBUFFER, gl->main_fb);
+
GLenum obj = gl->version ? GL_BACK_LEFT : GL_BACK;
+ if (gl->main_fb)
+ obj = GL_COLOR_ATTACHMENT0;
+
GLint depth_r = -1, depth_g = -1, depth_b = -1;
gl->GetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, obj,
@@ -3356,6 +3361,8 @@ static void init_gl(struct gl_video *p)
depth_r, depth_g, depth_b);
p->fb_depth = depth_g > 0 ? depth_g : 8;
+
+ gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
}
p->upload_timer = gl_timer_create(p->gl);