[gtk] gl renderer: bind the texture framebuffer before rendering



commit 1a7c280ebbbd4e089edac7f2b9a428a090a84db4
Author: Timm Bäder <mail baedert org>
Date:   Wed Apr 24 14:25:54 2019 +0200

    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.

 gsk/gl/gskglrenderer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 24b81c6d3f..00351cdbca 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]