[cluttermm_tutorial] Replace cogl_pop/push_matrix() with cogl_framebuffer_pop/push_matrix.



commit 38cf4301c78a63a61017acfe79b483de658b2b18
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Apr 17 21:21:51 2014 +0200

    Replace cogl_pop/push_matrix() with cogl_framebuffer_pop/push_matrix.
    
    Though this new API needs us to define COGL_ENABLE_EXPERIMENTAL_API
    before including cogl/cogl.h and none of the clutter examples or
    clutter itself use this - they still use clutter_push_matrix.

 examples/custom_actor/triangle_actor.cc |   12 +++++++++---
 examples/custom_container/examplebox.cc |   13 ++++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/examples/custom_actor/triangle_actor.cc b/examples/custom_actor/triangle_actor.cc
index a904759..1aee143 100644
--- a/examples/custom_actor/triangle_actor.cc
+++ b/examples/custom_actor/triangle_actor.cc
@@ -14,9 +14,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#include "triangle_actor.h"
+// This define seems to be necessary to use the non-deprecated
+// cogl_framebuffer_push_matrix() API though the deprecated cogl_push_matrix()
+// API that it replaces does not need this.
+#define COGL_ENABLE_EXPERIMENTAL_API
 #include <cogl/cogl.h>
 
+#include "triangle_actor.h"
+
 namespace Tutorial
 {
 
@@ -47,7 +52,8 @@ void Triangle::do_triangle_paint(const CoglColor* color)
 {
   const Clutter::Geometry geom = get_geometry();
 
-  cogl_push_matrix();
+  CoglFramebuffer* fb = cogl_get_draw_framebuffer();
+  cogl_framebuffer_push_matrix(fb);
   cogl_set_source_color(color);
 
   float coords[6];
@@ -66,7 +72,7 @@ void Triangle::do_triangle_paint(const CoglColor* color)
   cogl_path_polygon(coords, G_N_ELEMENTS(coords) / 2);
   cogl_path_fill();
 
-  cogl_pop_matrix();
+  cogl_framebuffer_pop_matrix(fb);
 }
 
 void Triangle::on_paint()
diff --git a/examples/custom_container/examplebox.cc b/examples/custom_container/examplebox.cc
index 9660767..ff39a6b 100644
--- a/examples/custom_container/examplebox.cc
+++ b/examples/custom_container/examplebox.cc
@@ -16,8 +16,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#include "examplebox.h"
+// This define seems to be necessary to use the non-deprecated
+// cogl_framebuffer_push_matrix() API though the deprecated cogl_push_matrix()
+// API that it replaces does not need this.
+#define COGL_ENABLE_EXPERIMENTAL_API
 #include <cogl/cogl.h>
+
+#include "examplebox.h"
+
 #include <algorithm>
 
 namespace Tutorial
@@ -105,7 +111,8 @@ void Box::foreach_vfunc(ClutterCallback callback, gpointer user_data)
 
 void Box::on_paint()
 {
-  cogl_push_matrix();
+  CoglFramebuffer* fb = cogl_get_draw_framebuffer();
+  cogl_framebuffer_push_matrix(fb);
 
   for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
   {
@@ -113,7 +120,7 @@ void Box::on_paint()
       (*p)->paint();
   }
 
-  cogl_pop_matrix();
+  cogl_framebuffer_pop_matrix(fb);
 }
 
 void Box::show_all_vfunc()


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