[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.
This commit is contained in:
Robert Bragg 2009-10-13 22:22:39 +01:00
parent c7d229585f
commit 2762e6d9b9

View File

@ -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 */