debug: Use cogl_primitive api for paint-volume visualization

Instead of using the cogl_vertex_buffer API this uses the more concise
cogl_primitive API instead. The aim is to get rid of the
cogl_vertex_buffer API eventually so we should be trying out the
replacement API wherever possible.
This commit is contained in:
Robert Bragg 2011-06-16 17:50:50 +01:00
parent 7f64772984
commit 1741c805be

View File

@ -2413,7 +2413,7 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
const CoglColor *color) const CoglColor *color)
{ {
static CoglMaterial *outline = NULL; static CoglMaterial *outline = NULL;
CoglHandle vbo; CoglPrimitive *prim;
ClutterVertex line_ends[12 * 2]; ClutterVertex line_ends[12 * 2];
int n_vertices; int n_vertices;
@ -2445,20 +2445,13 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
line_ends[22] = pv->vertices[3]; line_ends[23] = pv->vertices[7]; line_ends[22] = pv->vertices[3]; line_ends[23] = pv->vertices[7];
} }
vbo = cogl_vertex_buffer_new (n_vertices); prim = cogl_primitive_new_p3 (COGL_VERTICES_MODE_LINES, n_vertices,
cogl_vertex_buffer_add (vbo, (CoglVertexP3 *)line_ends);
"gl_Vertex",
3, /* n_components */
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
0, /* stride */
line_ends);
cogl_material_set_color (outline, color); cogl_material_set_color (outline, color);
cogl_set_source (outline); cogl_set_source (outline);
cogl_vertex_buffer_draw (vbo, COGL_VERTICES_MODE_LINES, cogl_primitive_draw (prim);
0 , n_vertices); cogl_object_unref (prim);
cogl_object_unref (vbo);
if (label) if (label)
{ {