From a5cdfdfd87b2fa559460ac117f4ed27474a6f47f Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 30 Apr 2009 22:19:43 +0100 Subject: [PATCH] [cogl-offscreen] Cleans up the cogl offscreen API and adds documentation There were several functions I believe no one is currently using that were only implemented in the GL backend (cogl_offscreen_blit_region and cogl_offscreen_blit) that have simply been removed so we have a chance to think about design later with a real use case. There was one nonsense function (cogl_offscreen_new_multisample) that sounded exciting but in all cases it just returned COGL_INVALID_HANDLE (though at least for GL it checked for multisampling support first!?) it has also been removed. The MASK draw buffer type has been removed. If we want to expose color masking later then I think it at least would be nicer to have the mask be a property that can be set on any draw buffer. The cogl_draw_buffer and cogl_{push,pop}_draw_buffer function prototypes have been moved up into cogl.h since they are for managing global Cogl state and not for modifying or creating the actual offscreen buffers. This also documents the API so for example desiphering the semantics of cogl_offscreen_new_to_texture() should be a bit easier now. --- README | 54 +++++++----- clutter/clutter-texture.c | 4 +- clutter/cogl/cogl-offscreen.h | 99 ++++++--------------- clutter/cogl/cogl-types.h | 4 +- clutter/cogl/cogl.h.in | 29 +++++++ clutter/cogl/common/cogl-util.c | 1 - clutter/cogl/gl/cogl-fbo.c | 109 ++---------------------- clutter/cogl/gles/cogl-fbo.c | 91 ++------------------ clutter/cogl/gles/cogl-texture.c | 5 -- doc/reference/cogl/cogl-sections.txt | 4 +- tests/interactive/test-cogl-offscreen.c | 4 +- 11 files changed, 105 insertions(+), 299 deletions(-) diff --git a/README b/README index 2bc9afb8d..2bf2a039a 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Clutter 1.0 README ================== Clutter is an open source software library for creating fast, visually -rich and animated graphical user interfaces. +rich and animated graphical user interfaces. Clutter currently requires: @@ -11,15 +11,15 @@ Clutter currently requires: * OpenGL >= 1.4, OpenGL ES 1.1 or OpenGL ES 2.0 * GLX, SDL, WGL or an EGL Implementation -The official website is: +The official website is: http://www.clutter-project.org The Clutter blog is at http://www.clutter-project.org/blog -To subscribe to the Clutter mailing list, send mail to: - clutter+subscribe@o-hand.com -The official mailing list archive is: +To subscribe to the Clutter mailing list, send mail to: + clutter+subscribe@o-hand.com +The official mailing list archive is: http://lists.o-hand.com/clutter/ -New bug page on Bugzilla: +New bug page on Bugzilla: http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter Clutter is licensed under the terms of the GNU Lesser General Public @@ -32,7 +32,7 @@ See the INSTALL file. Info on specific Clutter options; --enable-debug=[no/minimum/yes] Turn on debugging (default=yes): - yes: All glib asserts, checks and runtime clutter verbose messages. + yes: All glib asserts, checks and runtime clutter verbose messages. minimum: Just glib cast checks and runtime clutter verbose messagaes. no: No glib asserts or checks and no runtime clutter verbose messages (Only really of use in extreme performance cases) @@ -40,15 +40,15 @@ See the INSTALL file. Info on specific Clutter options; --enable-maintainer-flags=[no/yes] Use strict compiler flags (default=no) - --enable-gtk-doc - use gtk-doc to build API documentation (default=no). Requires gtk-doc + --enable-gtk-doc + use gtk-doc to build API documentation (default=no). Requires gtk-doc present on system --enable-manual=[no/yes] Build application developers manual. Requires jw and xmlto binaries. Presently incomplete. - --without-fpu + --without-fpu Assume target hardware has no floating point unit. Useful only for embedded targets such as ARM. @@ -307,6 +307,16 @@ Release Notes for Clutter 1.0 * cogl_get_*_matrix were changed to use the CoglMatrix type instead of GLfloat m[16] arrays. +* cogl_offscreen_blit_region, cogl_offscreen_blit were removed since they were + only implemnted for GL, not GLES, and it was assumed no one was using them. + +* cogl_offscreen_new_multisample was removed since it only ever returned + COGL_INVALID_HANDLE so it wasn't usefull. + +* The COGL_MASK_BUFFER type was removed, since there should be nicer ways of + exposing color mask if anyone wants it later. It was assumed that no one was + using this currently. + Release Notes for Clutter 0.8 ------------------------------- @@ -318,7 +328,7 @@ Release Notes for Clutter 0.8 support. It is now also fully documented. * GL Texture Rectangle ext is no longer used, the regular 2D NPOTS - extension is preffered instead but not required. + extension is preffered instead but not required. * Clutter now has basic suppport for multiple input devices assuming the backend supports it (currently X11 based via XInput and Fruity @@ -327,7 +337,7 @@ Release Notes for Clutter 0.8 clutter_grab_pointer_for_device & clutter_ungrab_pointer_for_device. XInput support needs to be explicitly enabled at runtime by calling - clutter_x11_enable_xinput () before clutter_init. clutter_x11_has_xinput () + clutter_x11_enable_xinput () before clutter_init. clutter_x11_has_xinput () can then be called after to check if XInput extension present and use-able. * The functions that return the transformed position of an actor have @@ -423,16 +433,16 @@ Release Notes for Clutter 0.8 * Clutter now features support for multiple stages assuming supported by the backend. See test-multistage.c for example of usage. This does not change the automatic creation of the default stage. - A single GL context is used across all stages meaning GL resources - are shared. + A single GL context is used across all stages meaning GL resources + are shared. * There is now an experimental native iPod Touch/iPhone UIKit backend named 'fruity'. * There is now an experimental native Win32 WGL backend. -* COGL (and therefor Clutter) now optionally features initial support for - OpenGL ES 2.0. It features support for shaders. +* COGL (and therefor Clutter) now optionally features initial support for + OpenGL ES 2.0. It features support for shaders. * Some more focused timeline unit tests have been added and some tweaks to timeline semantics were made; E.g. For a 10 frame timeline here are some @@ -469,7 +479,7 @@ Release Notes for Clutter 0.8 X Drawables (such as windows as pixmaps) via the 'texture_from_pixmap' GLX extension if available and fallback to slower XGetImage copies if not. -* ClutterContainer can have per child custom properties via ClutterChildMeta. +* ClutterContainer can have per child custom properties via ClutterChildMeta. Release Notes for Clutter 0.6 ------------------------------- @@ -582,11 +592,11 @@ Release Notes for Clutter 0.4.0 Release Notes for Clutter 0.3.1 ------------------------------- -* clutter_actor_apply_transform_to_point() parameters changed to use +* clutter_actor_apply_transform_to_point() parameters changed to use ClutterVertices. -* New 'Native API' backend expects EGL implementation to provide a - CreateNativeWindow() API call. +* New 'Native API' backend expects EGL implementation to provide a + CreateNativeWindow() API call. * Exisiting X11 based egl backend public API calls now prefixed eglx. @@ -600,7 +610,7 @@ Release Notes for Clutter 0.3 clutter_texture_set_from_yuv_data(). * The GLX specific API has been moved to the GLX backend code and - it's now under the ClutterGlx namespace. + it's now under the ClutterGlx namespace. * The priority of the various users of the GLib main loop has been reviewed and changed were necessary. Every paint is queued with a @@ -635,7 +645,7 @@ Release Notes for Clutter 0.3 * clutter_color_parse() now handles color definitions with alpha. Alpha will default to fully Opaque rather than fully transparent if not specified. -* The Clutter examples/ directory has been removed and replaced with a +* The Clutter examples/ directory has been removed and replaced with a tests/ directory. * The ClutterEvent API has been changed, and specific functions have been diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index afa094453..8c0dab500 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -563,7 +563,7 @@ clutter_texture_paint (ClutterActor *self) clutter_shader_set_is_enabled (shader, FALSE); /* Redirect drawing to the fbo */ - cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->fbo_handle); + cogl_set_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->fbo_handle); if ((stage = clutter_actor_get_stage (self))) { @@ -609,7 +609,7 @@ clutter_texture_paint (ClutterActor *self) cogl_clip_stack_restore (); /* Restore drawing to the frame buffer */ - cogl_draw_buffer (COGL_WINDOW_BUFFER, COGL_INVALID_HANDLE); + cogl_set_draw_buffer (COGL_WINDOW_BUFFER, COGL_INVALID_HANDLE); /* Restore the perspective matrix using cogl_perspective so that the inverse matrix will be right */ diff --git a/clutter/cogl/cogl-offscreen.h b/clutter/cogl/cogl-offscreen.h index 6be6cf0f2..ca4edb49c 100644 --- a/clutter/cogl/cogl-offscreen.h +++ b/clutter/cogl/cogl-offscreen.h @@ -35,43 +35,47 @@ G_BEGIN_DECLS /** * SECTION:cogl-offscreen * @short_description: Fuctions for creating and manipulating offscreen - * frame buffer objects + * frame buffer objects * - * COGL allows creating and operating on FBOs (Framebuffer Objects). + * Cogl allows creating and operating on offscreen render targets. */ /* Offscreen api */ /** * cogl_offscreen_new_to_texture: - * @texhandle: + * @handle: A CoglHandle for a Cogl texture * - * Returns: + * This creates an offscreen buffer object using the given texture as the + * primary color buffer. It doesn't just initialize the contents of the + * offscreen buffer with the texture; they are tightly bound so that + * drawing to the offscreen buffer effectivly updates the contents of the + * given texture. You don't need to destroy the offscreen buffer before + * you can use the texture again. + * + * Note: This does not work with sliced Cogl textures. + * + * Returns: a CoglHandle for the new offscreen buffer or COGL_INVALID_HANDLE + * if it wasn't possible to create the buffer. */ CoglHandle cogl_offscreen_new_to_texture (CoglHandle texhandle); -/** - * cogl_offscreen_new_multisample: - * - * - * Returns: - */ -CoglHandle cogl_offscreen_new_multisample (void); - /** * cogl_offscreen_ref: - * @handle: + * @handle: A CoglHandle for an offscreen buffer * - * Returns: + * Increments the reference count on the offscreen buffer. + * + * Returns: For convenience it returns the given CoglHandle */ CoglHandle cogl_offscreen_ref (CoglHandle handle); /** * cogl_is_offscreen: - * @handle: A CoglHandle + * @handle: A CoglHandle for an offscreen buffer * - * Gets whether the given handle references an existing offscreen - * buffer object. + * Gets whether the given handle references an existing offscreen buffer + * object. * * Returns: %TRUE if the handle references an offscreen buffer, * %FALSE otherwise @@ -80,68 +84,13 @@ gboolean cogl_is_offscreen (CoglHandle handle); /** * cogl_offscreen_unref: - * @handle: + * @handle: A CoglHandle for an offscreen buffer * + * Decreases the reference count for the offscreen buffer and frees it when + * the count reaches 0. */ void cogl_offscreen_unref (CoglHandle handle); -/** - * cogl_offscreen_blit: - * @src_buffer: - * @dst_buffer: - * - */ -void cogl_offscreen_blit (CoglHandle src_buffer, - CoglHandle dst_buffer); - -/** - * cogl_offscreen_blit_region: - * @src_buffer: - * @dst_buffer: - * @src_x: - * @src_y: - * @src_w: - * @src_h: - * @dst_x: - * @dst_y: - * @dst_w: - * @dst_h: - * - */ -void cogl_offscreen_blit_region (CoglHandle src_buffer, - CoglHandle dst_buffer, - gint src_x, - gint src_y, - gint src_w, - gint src_h, - gint dst_x, - gint dst_y, - gint dst_w, - gint dst_h); - -/** - * cogl_draw_buffer: - * @target: - * @offscreen: - * - */ -void cogl_draw_buffer (CoglBufferTarget target, - CoglHandle offscreen); - -/** - * cogl_push_draw_buffer: - * - * Save cogl_draw_buffer() state. - */ -void cogl_push_draw_buffer (void); - -/** - * cogl_pop_draw_buffer: - * - * Restore cogl_draw_buffer() state. - */ -void cogl_pop_draw_buffer (void); - G_END_DECLS #endif /* __COGL_OFFSCREEN_H__ */ diff --git a/clutter/cogl/cogl-types.h b/clutter/cogl/cogl-types.h index b2c082bc8..a4ecd4193 100644 --- a/clutter/cogl/cogl-types.h +++ b/clutter/cogl/cogl-types.h @@ -228,7 +228,6 @@ GType cogl_feature_flags_get_type (void) G_GNUC_CONST; /** * CoglBufferTarget: * @COGL_WINDOW_BUFFER: FIXME - * @COGL_MASK_BUFFER: FIXME * @COGL_OFFSCREEN_BUFFER: FIXME * * Target flags for FBOs. @@ -238,8 +237,7 @@ GType cogl_feature_flags_get_type (void) G_GNUC_CONST; typedef enum { COGL_WINDOW_BUFFER = (1 << 1), - COGL_MASK_BUFFER = (1 << 2), - COGL_OFFSCREEN_BUFFER = (1 << 3) + COGL_OFFSCREEN_BUFFER = (1 << 2) } CoglBufferTarget; #define COGL_TYPE_BUFFER_TARGET (cogl_buffer_target_get_type ()) diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in index 2422cd1da..594fc77ca 100644 --- a/clutter/cogl/cogl.h.in +++ b/clutter/cogl/cogl.h.in @@ -578,6 +578,35 @@ void cogl_clip_stack_save (void); */ void cogl_clip_stack_restore (void); +/** + * cogl_set_draw_buffer: + * @target: A #CoglBufferTarget that specifies what kind of draw buffer you + * are setting as the render target. + * @offscreen: If you are setting a draw buffer of type COGL_OFFSCREEN_BUFFER + * then this is a CoglHandle for the offscreen buffer. + * + * This redirects all subsequent drawing to the specified draw buffer. This + * can either be an offscreen buffer created with + * cogl_offscreen_new_to_texture () or you can revert to your original + * on screen window buffer. + */ +void cogl_set_draw_buffer (CoglBufferTarget target, + CoglHandle offscreen); + +/** + * cogl_push_draw_buffer: + * + * Save cogl_set_draw_buffer() state. + */ +void cogl_push_draw_buffer (void); + +/** + * cogl_pop_draw_buffer: + * + * Restore cogl_set_draw_buffer() state. + */ +void cogl_pop_draw_buffer (void); + /** * cogl_flush_gl_state: * @flags: flags controlling what is flushed; currently unused, pass in 0 diff --git a/clutter/cogl/common/cogl-util.c b/clutter/cogl/common/cogl-util.c index 1eb0db10e..d71b9ffd8 100644 --- a/clutter/cogl/common/cogl-util.c +++ b/clutter/cogl/common/cogl-util.c @@ -179,7 +179,6 @@ cogl_buffer_target_get_type (void) { static const GFlagsValue values[] = { { COGL_WINDOW_BUFFER, "COGL_WINDOW_BUFFER", "window-buffer" }, - { COGL_MASK_BUFFER, "COGL_MASK_BUFFER", "mask-buffer" }, { COGL_OFFSCREEN_BUFFER, "COGL_OFFSCREEN_BUFFER", "offscreen-buffer" }, { 0, NULL, NULL } }; diff --git a/clutter/cogl/gl/cogl-fbo.c b/clutter/cogl/gl/cogl-fbo.c index a5f6e22fd..db99e6ace 100644 --- a/clutter/cogl/gl/cogl-fbo.c +++ b/clutter/cogl/gl/cogl-fbo.c @@ -148,15 +148,6 @@ cogl_offscreen_new_to_texture (CoglHandle texhandle) return _cogl_offscreen_handle_new (fbo); } -CoglHandle -cogl_offscreen_new_multisample () -{ - if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_MULTISAMPLE)) - return COGL_INVALID_HANDLE; - - return COGL_INVALID_HANDLE; -} - static void _cogl_offscreen_free (CoglFbo *fbo) { @@ -171,75 +162,7 @@ _cogl_offscreen_free (CoglFbo *fbo) } void -cogl_offscreen_blit_region (CoglHandle src_buffer, - CoglHandle dst_buffer, - int src_x, - int src_y, - int src_w, - int src_h, - int dst_x, - int dst_y, - int dst_w, - int dst_h) -{ - CoglFbo *src_fbo; - CoglFbo *dst_fbo; - - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT)) - return; - - /* Make sure these are valid fbo handles */ - if (!cogl_is_offscreen (src_buffer)) - return; - - if (!cogl_is_offscreen (dst_buffer)) - return; - - src_fbo = _cogl_offscreen_pointer_from_handle (src_buffer); - dst_fbo = _cogl_offscreen_pointer_from_handle (dst_buffer); - - /* Copy (and scale) a region from one to another framebuffer */ - GE( glBindFramebufferEXT (GL_READ_FRAMEBUFFER_EXT, src_fbo->gl_handle) ); - GE( glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, dst_fbo->gl_handle) ); - GE( glBlitFramebufferEXT (src_x, src_y, src_x + src_w, src_y + src_h, - dst_x, dst_y, dst_x + dst_w, dst_y + dst_h, - GL_COLOR_BUFFER_BIT, GL_LINEAR) ); -} - -void -cogl_offscreen_blit (CoglHandle src_buffer, - CoglHandle dst_buffer) -{ - CoglFbo *src_fbo; - CoglFbo *dst_fbo; - - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT)) - return; - - /* Make sure these are valid fbo handles */ - if (!cogl_is_offscreen (src_buffer)) - return; - - if (!cogl_is_offscreen (dst_buffer)) - return; - - src_fbo = _cogl_offscreen_pointer_from_handle (src_buffer); - dst_fbo = _cogl_offscreen_pointer_from_handle (dst_buffer); - - /* Copy (and scale) whole image from one to another framebuffer */ - GE( glBindFramebufferEXT (GL_READ_FRAMEBUFFER_EXT, src_fbo->gl_handle) ); - GE( glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, dst_fbo->gl_handle) ); - GE( glBlitFramebufferEXT (0, 0, src_fbo->width, src_fbo->height, - 0, 0, dst_fbo->width, dst_fbo->height, - GL_COLOR_BUFFER_BIT, GL_LINEAR) ); -} - -void -cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) +cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) { CoglFbo *fbo = NULL; CoglDrawBufferState *draw_buffer; @@ -301,10 +224,8 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) GE( glEnable (GL_SCISSOR_TEST) ); GE( glClear (GL_COLOR_BUFFER_BIT) ); GE( glPopAttrib () ); - } - else if ((target & COGL_WINDOW_BUFFER) || - (target & COGL_MASK_BUFFER)) + else if (target & COGL_WINDOW_BUFFER) { /* Check current draw buffer target */ if (draw_buffer->target == COGL_OFFSCREEN_BUFFER) @@ -322,23 +243,6 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) /* Bind window framebuffer object */ GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0) ); - - - if (target == COGL_WINDOW_BUFFER) - { - /* Draw to RGB channels */ - GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE) ); - } - else if (target == COGL_MASK_BUFFER) - { - /* Draw only to ALPHA channel */ - GE( glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE) ); - } - else - { - /* Draw to all channels */ - GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) ); - } } /* Store new target */ @@ -389,14 +293,14 @@ cogl_pop_draw_buffer(void) to_pop = ctx->draw_buffer_stack->data; to_restore = ctx->draw_buffer_stack->next->data; - /* the logic in cogl_draw_buffer() only works if + /* the logic in cogl_set_draw_buffer() only works if * to_pop is still on top of the stack, because - * cogl_draw_buffer() needs to know the previous + * cogl_set_draw_buffer() needs to know the previous * state. */ - cogl_draw_buffer (to_restore->target, to_restore->offscreen); + cogl_set_draw_buffer (to_restore->target, to_restore->offscreen); - /* cogl_draw_buffer() should have set top of stack + /* cogl_set_draw_buffer() should have set top of stack * to to_restore */ g_assert (to_restore->target == to_pop->target); @@ -409,3 +313,4 @@ cogl_pop_draw_buffer(void) g_slice_free (CoglDrawBufferState, to_pop); } + diff --git a/clutter/cogl/gles/cogl-fbo.c b/clutter/cogl/gles/cogl-fbo.c index 2b8aa46fa..08b6cff13 100644 --- a/clutter/cogl/gles/cogl-fbo.c +++ b/clutter/cogl/gles/cogl-fbo.c @@ -130,15 +130,6 @@ cogl_offscreen_new_to_texture (CoglHandle texhandle) return _cogl_offscreen_handle_new (fbo); } -CoglHandle -cogl_offscreen_new_multisample () -{ - if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_MULTISAMPLE)) - return COGL_INVALID_HANDLE; - - return COGL_INVALID_HANDLE; -} - static void _cogl_offscreen_free (CoglFbo *fbo) { @@ -153,31 +144,7 @@ _cogl_offscreen_free (CoglFbo *fbo) } void -cogl_offscreen_blit_region (CoglHandle src_buffer, - CoglHandle dst_buffer, - int src_x, - int src_y, - int src_w, - int src_h, - int dst_x, - int dst_y, - int dst_w, - int dst_h) -{ - /* Not supported on GLES */ - return; -} - -void -cogl_offscreen_blit (CoglHandle src_buffer, - CoglHandle dst_buffer) -{ - /* Not supported on GLES */ - return; -} - -void -cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) +cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) { CoglFbo *fbo = NULL; CoglDrawBufferState *draw_buffer; @@ -249,8 +216,7 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) scissor_box[2], scissor_box[3]); } - else if ((target & COGL_WINDOW_BUFFER) || - (target & COGL_MASK_BUFFER)) + else if (target & COGL_WINDOW_BUFFER) { /* Check current draw buffer target */ if (draw_buffer->target == COGL_OFFSCREEN_BUFFER) @@ -269,23 +235,6 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) /* Bind window framebuffer object */ GE( glBindFramebuffer (GL_FRAMEBUFFER, 0) ); - - - if (target == COGL_WINDOW_BUFFER) - { - /* Draw to RGB channels */ - GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) ); - } - else if (target == COGL_MASK_BUFFER) - { - /* Draw only to ALPHA channel */ - GE( glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE) ); - } - else - { - /* Draw to all channels */ - GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) ); - } } /* Store new target */ @@ -336,14 +285,14 @@ cogl_pop_draw_buffer(void) to_pop = ctx->draw_buffer_stack->data; to_restore = ctx->draw_buffer_stack->next->data; - /* the logic in cogl_draw_buffer() only works if + /* the logic in cogl_set_draw_buffer() only works if * to_pop is still on top of the stack, because - * cogl_draw_buffer() needs to know the previous + * cogl_set_draw_buffer() needs to know the previous * state. */ - cogl_draw_buffer (to_restore->target, to_restore->offscreen); + cogl_set_draw_buffer (to_restore->target, to_restore->offscreen); - /* cogl_draw_buffer() should have set top of stack + /* cogl_set_draw_buffer() should have set top of stack * to to_restore */ g_assert (to_restore->target == to_pop->target); @@ -373,12 +322,6 @@ cogl_offscreen_new_to_texture (CoglHandle texhandle) return COGL_INVALID_HANDLE; } -CoglHandle -cogl_offscreen_new_multisample () -{ - return COGL_INVALID_HANDLE; -} - CoglHandle cogl_offscreen_ref (CoglHandle handle) { @@ -391,27 +334,7 @@ cogl_offscreen_unref (CoglHandle handle) } void -cogl_offscreen_blit_region (CoglHandle src_buffer, - CoglHandle dst_buffer, - int src_x, - int src_y, - int src_w, - int src_h, - int dst_x, - int dst_y, - int dst_w, - int dst_h) -{ -} - -void -cogl_offscreen_blit (CoglHandle src_buffer, - CoglHandle dst_buffer) -{ -} - -void -cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) +cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) { } diff --git a/clutter/cogl/gles/cogl-texture.c b/clutter/cogl/gles/cogl-texture.c index 959332919..0954798d9 100644 --- a/clutter/cogl/gles/cogl-texture.c +++ b/clutter/cogl/gles/cogl-texture.c @@ -483,9 +483,6 @@ _cogl_texture_download_from_gl (CoglTexture *tex, _cogl_current_matrix_push (); _cogl_current_matrix_identity (); - /* Draw to all channels */ - cogl_draw_buffer (COGL_WINDOW_BUFFER | COGL_MASK_BUFFER, 0); - /* Direct copy operation */ if (ctx->texture_download_material == COGL_INVALID_HANDLE) @@ -582,8 +579,6 @@ _cogl_texture_download_from_gl (CoglTexture *tex, _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW); _cogl_current_matrix_pop (); - cogl_draw_buffer (COGL_WINDOW_BUFFER, 0); - return TRUE; } diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt index bc9d6afc1..ff8df1cbc 100644 --- a/doc/reference/cogl/cogl-sections.txt +++ b/doc/reference/cogl/cogl-sections.txt @@ -173,9 +173,7 @@ cogl_offscreen_new_to_texture cogl_offscreen_ref cogl_offscreen_unref cogl_is_offscreen -cogl_offscreen_blit -cogl_offscreen_blit_region -cogl_draw_buffer +cogl_set_draw_buffer cogl_offscreen_new_multisample diff --git a/tests/interactive/test-cogl-offscreen.c b/tests/interactive/test-cogl-offscreen.c index e03ff8fe2..366053dc9 100644 --- a/tests/interactive/test-cogl-offscreen.c +++ b/tests/interactive/test-cogl-offscreen.c @@ -95,7 +95,7 @@ test_coglbox_paint(ClutterActor *self) 0, 0, 6, 6); - cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id); + cogl_set_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id); cogl_set_source_color4ub (0xff, 0, 0, 0xff); cogl_rectangle (20, 20, 20 + 100, 20 + 100); @@ -103,7 +103,7 @@ test_coglbox_paint(ClutterActor *self) cogl_set_source_color4ub (0, 0xff, 0, 0xff); cogl_rectangle (80, 80, 80 + 100, 80 + 100); - cogl_draw_buffer (COGL_WINDOW_BUFFER, 0); + cogl_set_draw_buffer (COGL_WINDOW_BUFFER, 0); material = cogl_material_new (); cogl_material_set_color4ub (material, 0xff, 0xff, 0xff, 0x88);