[clutter] test-cogl-depth-test: Update to new Cogl API



commit c18a83baa3239cc635be0732e8d0a859604b6d4c
Author: Neil Roberts <neil linux intel com>
Date:   Mon May 16 18:57:37 2011 +0100

    test-cogl-depth-test: Update to new Cogl API
    
    The Cogl depth state API has changed to have a separate CoglDepthState
    struct so this test was no longer building. This patch updates it to
    use CoglPipeline and the new depth state API.

 tests/conform/test-cogl-depth-test.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/tests/conform/test-cogl-depth-test.c b/tests/conform/test-cogl-depth-test.c
index 5263686..335e558 100644
--- a/tests/conform/test-cogl-depth-test.c
+++ b/tests/conform/test-cogl-depth-test.c
@@ -68,28 +68,30 @@ draw_rectangle (TestState *state,
                 int y,
                 TestDepthState *rect_state)
 {
+  CoglDepthState depth_state;
   guint8 Cr = MASK_RED (rect_state->color);
   guint8 Cg = MASK_GREEN (rect_state->color);
   guint8 Cb = MASK_BLUE (rect_state->color);
   guint8 Ca = MASK_ALPHA (rect_state->color);
-  CoglHandle material;
-
-  material = cogl_material_new ();
-  cogl_material_set_depth_test_enabled (material, rect_state->test_enable);
-  cogl_material_set_depth_test_function (material, rect_state->test_function);
-  cogl_material_set_depth_writing_enabled (material, rect_state->write_enable);
-  if (!cogl_material_set_depth_range (material,
-                                      rect_state->range_near,
-                                      rect_state->range_far,
-                                      NULL))
+  CoglPipeline *pipeline;
+
+  pipeline = cogl_pipeline_new ();
+  cogl_depth_state_init (&depth_state);
+  cogl_depth_state_set_test_enabled (&depth_state, rect_state->test_enable);
+  cogl_depth_state_set_test_function (&depth_state, rect_state->test_function);
+  cogl_depth_state_set_write_enabled (&depth_state, rect_state->write_enable);
+  cogl_depth_state_set_range (&depth_state,
+                              rect_state->range_near,
+                              rect_state->range_far);
+  if (!cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL))
     {
-      cogl_handle_unref (material);
+      cogl_object_unref (pipeline);
       return FALSE;
     }
 
-  cogl_material_set_color4ub (material, Cr, Cg, Cb, Ca);
+  cogl_pipeline_set_color4ub (pipeline, Cr, Cg, Cb, Ca);
 
-  cogl_set_source (material);
+  cogl_set_source (pipeline);
 
   cogl_push_matrix ();
   cogl_translate (0, 0, rect_state->depth);
@@ -99,7 +101,7 @@ draw_rectangle (TestState *state,
                   y * QUAD_WIDTH + QUAD_WIDTH);
   cogl_pop_matrix ();
 
-  cogl_handle_unref (material);
+  cogl_object_unref (pipeline);
 
   return TRUE;
 }



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