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.
This commit is contained in:
Neil Roberts 2011-05-16 18:57:37 +01:00
parent 86dce2fd98
commit c18a83baa3

View File

@ -68,28 +68,30 @@ draw_rectangle (TestState *state,
int y, int y,
TestDepthState *rect_state) TestDepthState *rect_state)
{ {
CoglDepthState depth_state;
guint8 Cr = MASK_RED (rect_state->color); guint8 Cr = MASK_RED (rect_state->color);
guint8 Cg = MASK_GREEN (rect_state->color); guint8 Cg = MASK_GREEN (rect_state->color);
guint8 Cb = MASK_BLUE (rect_state->color); guint8 Cb = MASK_BLUE (rect_state->color);
guint8 Ca = MASK_ALPHA (rect_state->color); guint8 Ca = MASK_ALPHA (rect_state->color);
CoglHandle material; CoglPipeline *pipeline;
material = cogl_material_new (); pipeline = cogl_pipeline_new ();
cogl_material_set_depth_test_enabled (material, rect_state->test_enable); cogl_depth_state_init (&depth_state);
cogl_material_set_depth_test_function (material, rect_state->test_function); cogl_depth_state_set_test_enabled (&depth_state, rect_state->test_enable);
cogl_material_set_depth_writing_enabled (material, rect_state->write_enable); cogl_depth_state_set_test_function (&depth_state, rect_state->test_function);
if (!cogl_material_set_depth_range (material, cogl_depth_state_set_write_enabled (&depth_state, rect_state->write_enable);
rect_state->range_near, cogl_depth_state_set_range (&depth_state,
rect_state->range_far, rect_state->range_near,
NULL)) rect_state->range_far);
if (!cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL))
{ {
cogl_handle_unref (material); cogl_object_unref (pipeline);
return FALSE; 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_push_matrix ();
cogl_translate (0, 0, rect_state->depth); cogl_translate (0, 0, rect_state->depth);
@ -99,7 +101,7 @@ draw_rectangle (TestState *state,
y * QUAD_WIDTH + QUAD_WIDTH); y * QUAD_WIDTH + QUAD_WIDTH);
cogl_pop_matrix (); cogl_pop_matrix ();
cogl_handle_unref (material); cogl_object_unref (pipeline);
return TRUE; return TRUE;
} }