summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/gl_video.c16
-rw-r--r--video/out/gl_video.h2
-rw-r--r--video/out/vo_opengl.c4
3 files changed, 12 insertions, 10 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index fd4e3c5173..65cdf90d42 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -1642,11 +1642,15 @@ static void handle_pass(struct gl_video *p, struct pass *chain,
};
}
-void gl_video_render_frame(struct gl_video *p)
+// (fbo==0 makes BindFramebuffer select the screen backbuffer)
+void gl_video_render_frame(struct gl_video *p, int fbo)
{
GL *gl = p->gl;
struct video_image *vimg = &p->image;
+ gl->BindFramebuffer(GL_FRAMEBUFFER, fbo);
+ gl->Viewport(p->vp_x, p->vp_y, p->vp_w, p->vp_h);
+
if (p->opts.temporal_dither)
change_dither_trafo(p);
@@ -1693,7 +1697,7 @@ void gl_video_render_frame(struct gl_video *p)
.vp_y = p->vp_y,
.vp_w = p->vp_w,
.vp_h = p->vp_h,
- .texture = 0, //makes BindFramebuffer select the screen backbuffer
+ .fbo = fbo,
};
// For Y direction, use the whole source viewport; it has been fit to the
@@ -1712,8 +1716,6 @@ void gl_video_render_frame(struct gl_video *p)
handle_pass(p, &chain, &screen, p->final_program);
gl->UseProgram(0);
- gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
- gl->Viewport(p->vp_x, p->vp_y, p->vp_w, p->vp_h);
unset_image_textures(p);
@@ -1723,6 +1725,8 @@ void gl_video_render_frame(struct gl_video *p)
draw_osd:
draw_osd(p);
+
+ gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
}
static void update_window_sized_objects(struct gl_video *p)
@@ -1798,7 +1802,6 @@ void gl_video_resize(struct gl_video *p, struct mp_rect *window,
p->vp_w = window->x1 - window->x0;
p->vp_h = window->y1 - window->y0;
- p->gl->Viewport(p->vp_x, p->vp_y, p->vp_w, p->vp_h);
check_resize(p);
}
@@ -2473,10 +2476,9 @@ static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt,
// gl_video_resize() should be called when user interaction is done.
void gl_video_resize_redraw(struct gl_video *p, int w, int h)
{
- p->gl->Viewport(p->vp_x, p->vp_y, w, h);
p->vp_w = w;
p->vp_h = h;
- gl_video_render_frame(p);
+ gl_video_render_frame(p, 0);
}
void gl_video_set_hwdec(struct gl_video *p, struct gl_hwdec *hwdec)
diff --git a/video/out/gl_video.h b/video/out/gl_video.h
index a28109a5a2..bba24e364a 100644
--- a/video/out/gl_video.h
+++ b/video/out/gl_video.h
@@ -65,7 +65,7 @@ void gl_video_config(struct gl_video *p, struct mp_image_params *params);
void gl_video_set_output_depth(struct gl_video *p, int r, int g, int b);
void gl_video_set_lut3d(struct gl_video *p, struct lut3d *lut3d);
void gl_video_upload_image(struct gl_video *p, struct mp_image *img);
-void gl_video_render_frame(struct gl_video *p);
+void gl_video_render_frame(struct gl_video *p, int fbo);
struct mp_image *gl_video_download_image(struct gl_video *p);
void gl_video_resize(struct gl_video *p, struct mp_rect *window,
struct mp_rect *src, struct mp_rect *dst,
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index c7d274ec72..d3fdf88372 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -164,7 +164,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
mpgl_lock(p->glctx);
gl_video_upload_image(p->renderer, mpi);
- gl_video_render_frame(p->renderer);
+ gl_video_render_frame(p->renderer, 0);
// The playloop calls this last before waiting some time until it decides
// to call flip_page(). Tell OpenGL to start execution of the GPU commands
@@ -402,7 +402,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
return true;
case VOCTRL_REDRAW_FRAME:
mpgl_lock(p->glctx);
- gl_video_render_frame(p->renderer);
+ gl_video_render_frame(p->renderer, 0);
mpgl_unlock(p->glctx);
return true;
case VOCTRL_SET_COMMAND_LINE: {