examples: use framebuffer matrix stack apis

Instead of using apis like cogl_push/pop_matrix, cogl_rotate,
cogl_translate and cogl_scale all the examples now use the
cogl_framebuffer_* equivalents. Our aim is to remove the need for the
default CoglContext and so we are switching towards apis that
are explicitly tied to a specific context.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg
2012-01-07 23:48:08 +00:00
parent 7287dd1faf
commit 0365f6cda3
3 changed files with 23 additions and 17 deletions

View File

@ -17,15 +17,17 @@ typedef struct Data
static void
redraw (Data *data)
{
cogl_framebuffer_clear4f (data->fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
CoglFramebuffer *fb = data->fb;
cogl_push_matrix ();
cogl_translate (data->center_x, -data->center_y, 0.0f);
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
cogl_framebuffer_push_matrix (fb);
cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f);
cogl_primitive_draw (data->triangle);
cogl_pop_matrix ();
cogl_framebuffer_pop_matrix (fb);
cogl_framebuffer_swap_buffers (data->fb);
cogl_framebuffer_swap_buffers (fb);
}
static void