From 2762e6d9b90731fd05b46aac407cebd3ba372027 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 13 Oct 2009 22:22:39 +0100 Subject: [PATCH] [texture] push/pop draw buffer when painting actors to a texture When updating the FBO for a source actor (to support clutter_texture_new_from_actor()) we used to simply set an offscreen draw buffer to be current, paint the source actor and then explicitly set the window to be current again. This precluded chaining texture_new_from_actor though because updating another FBO associated with a source actor would end up restoring the window as the current buffer instead of the previous offscreen buffer. Now that we use Cogl's draw buffer stack; chaining clutter_texture_new_from_actor() should be possible. --- clutter/clutter-texture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index abc713d4c..246458de2 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -548,6 +548,7 @@ clutter_texture_paint (ClutterActor *self) clutter_shader_set_is_enabled (shader, FALSE); /* Redirect drawing to the fbo */ + cogl_push_draw_buffer (); cogl_set_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->fbo_handle); if ((stage = clutter_actor_get_stage (self))) @@ -589,8 +590,8 @@ clutter_texture_paint (ClutterActor *self) /* Render out actor scene to fbo */ clutter_actor_paint (priv->fbo_source); - /* Restore drawing to the frame buffer */ - cogl_set_draw_buffer (COGL_WINDOW_BUFFER, COGL_INVALID_HANDLE); + /* Restore drawing to the previous draw buffer */ + cogl_pop_draw_buffer (); /* Restore the perspective matrix using cogl_perspective so that the inverse matrix will be right */