typedef struct _CoglPangoDisplayListNode CoglPangoDisplayListNode;
typedef struct _CoglPangoDisplayListVertex CoglPangoDisplayListVertex;
-#ifdef HAVE_CLUTTER_GLX
-#define COGL_PANGO_DISPLAY_LIST_DRAW_MODE GL_QUADS
-#else
-/* GLES doesn't support GL_QUADS so we use GL_TRIANGLES instead */
-#define COGL_PANGO_DISPLAY_LIST_DRAW_MODE GL_TRIANGLES
-#endif
-
struct _CoglPangoDisplayList
{
CoglColor color;
verts->y = y_1;
verts->t_x = tx_2;
verts->t_y = ty_1;
-
-#ifndef HAVE_CLUTTER_GLX
-
- /* GLES doesn't support GL_QUADS so we use GL_TRIANGLES instead with
- two extra vertices per quad. FIXME: It might be better to use
- indexed elements here but cogl vertex buffers don't currently
- support storing the indices */
-
- g_array_set_size (node->d.texture.verts,
- node->d.texture.verts->len + 2);
- verts = &g_array_index (node->d.texture.verts,
- CoglPangoDisplayListVertex,
- node->d.texture.verts->len - 6);
-
- verts[4] = verts[0];
- verts[5] = verts[2];
-
-#endif /* HAVE_CLUTTER_GLX */
}
void
node->d.texture.vertex_buffer = vb;
}
+
+#ifdef CLUTTER_COGL_HAS_GL
+
cogl_vertex_buffer_draw (node->d.texture.vertex_buffer,
- COGL_PANGO_DISPLAY_LIST_DRAW_MODE,
+ GL_QUADS,
0, node->d.texture.verts->len);
+
+#else /* CLUTTER_COGL_HAS_GL */
+ {
+ /* GLES doesn't support GL_QUADS so instead we use a VBO with
+ indexed vertices to generate GL_TRIANGLES from the quads */
+
+ int n_indices = node->d.texture.verts->len / 4 * 6;
+ CoglHandle indices_vbo
+ = cogl_vertex_buffer_indices_get_for_quads (n_indices);
+
+ cogl_vertex_buffer_draw_elements (node->d.texture.vertex_buffer,
+ COGL_VERTICES_MODE_TRIANGLES,
+ indices_vbo,
+ 0, node->d.texture.verts->len - 1,
+ 0, n_indices);
+ }
+#endif /* CLUTTER_COGL_HAS_GL */
}
void