gl renderer: bind the texture framebuffer before rendering

When rendering to a texture, collecting the render ops might bind a
different framebuffer, so bind the one we want again before doing the
actual rendering.
This commit is contained in:
Timm Bäder 2019-04-24 14:25:54 +02:00 committed by Benjamin Otte
parent 4bb6e70d01
commit 1a7c280ebb

View File

@ -3012,6 +3012,10 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
#endif
/* Actually do the rendering */
if (fbo_id != 0)
glBindFramebuffer (GL_FRAMEBUFFER, fbo_id);
glViewport (0, 0, ceilf (viewport->size.width), ceilf (viewport->size.height));
gsk_gl_renderer_setup_render_mode (self);
gsk_gl_renderer_clear (self);
@ -3083,8 +3087,6 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_id, 0);
g_assert_cmphex (glCheckFramebufferStatus (GL_FRAMEBUFFER), ==, GL_FRAMEBUFFER_COMPLETE);
gsk_gl_renderer_clear (self);
/* Render the actual scene */
gsk_gl_renderer_do_render (renderer, root, viewport, fbo_id, 1);