static void
create_primitives (CoglPrimitive *primitives[2])
{
  static const Vertex vertex_data[8] =
    {
      /* triangle strip 1 */
      {   0,   0, 255, 0, 0, 255 },
      {   0, 100, 255, 0, 0, 255 },
      { 100,   0, 255, 0, 0, 255 },
      { 100, 100, 255, 0, 0, 255 },
      /* triangle strip 2 */
      { 200,   0, 0, 0, 255, 255 },
      { 200, 100, 0, 0, 255, 255 },
      { 300,   0, 0, 0, 255, 255 },
      { 300, 100, 0, 0, 255, 255 },
    };

  primitives[0] = cogl_primitive_new_p2c4 (test_ctx,
                                           COGL_VERTICES_MODE_TRIANGLE_STRIP,
                                           G_N_ELEMENTS (vertex_data),
                                           vertex_data);
  cogl_primitive_set_n_vertices (primitives[0], 4);

  primitives[1] = cogl_primitive_copy (primitives[0]);
  cogl_primitive_set_first_vertex (primitives[1], 4);
  cogl_primitive_set_n_vertices (primitives[1], 4);
}
Esempio n. 2
0
CoglPrimitive *
cogl_primitive_copy (CoglPrimitive *primitive)
{
  CoglPrimitive *copy;

  copy = cogl_primitive_new_with_attributes (primitive->mode,
                                             primitive->n_vertices,
                                             primitive->attributes,
                                             primitive->n_attributes);

  cogl_primitive_set_indices (copy, primitive->indices, primitive->n_vertices);
  cogl_primitive_set_first_vertex (copy, primitive->first_vertex);

  return copy;
}