diff --git a/clutter/cogl/cogl-vertex-buffer.h b/clutter/cogl/cogl-vertex-buffer.h
index 580ecfa10..4d229bd63 100644
--- a/clutter/cogl/cogl-vertex-buffer.h
+++ b/clutter/cogl/cogl-vertex-buffer.h
@@ -94,6 +94,24 @@ cogl_vertex_buffer_new (guint n_vertices);
guint
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
+/**
+ * CoglAttributeType:
+ * @COGL_ATTRIBUTE_TYPE_BYTE:
+ * @COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE:
+ * @COGL_ATTRIBUTE_TYPE_SHORT:
+ * @COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT:
+ * @COGL_ATTRIBUTE_TYPE_FLOAT:
+ *
+ */
+typedef enum _CoglAttributeType
+{
+ COGL_ATTRIBUTE_TYPE_BYTE = GL_BYTE,
+ COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE = GL_UNSIGNED_BYTE,
+ COGL_ATTRIBUTE_TYPE_SHORT = GL_SHORT,
+ COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT = GL_UNSIGNED_SHORT,
+ COGL_ATTRIBUTE_TYPE_FLOAT = GL_FLOAT
+} CoglAttributeType;
+
/**
* cogl_vertex_buffer_add:
* @handle: A vertex buffer handle
@@ -111,10 +129,9 @@ cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
* the name can have a detail component, E.g.
* "gl_Color::active" or "gl_Color::inactive"
* @n_components: The number of components per attribute and must be 1,2,3 or 4
- * @gl_type: Specifies the data type of each component (GL_BYTE, GL_UNSIGNED_BYTE,
- * GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT or GL_FLOAT)
+ * @type: a #CoglAttributeType specifying the data type of each component.
* @normalized: If GL_TRUE, this specifies that values stored in an integer
- * format should be mapped into the range [-1.0, 1.0] or [0.1, 1.0]
+ * format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0]
* for unsigned values. If GL_FALSE they are converted to floats
* directly.
* @stride: This specifies the number of bytes from the start of one attribute
@@ -156,13 +173,13 @@ cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
* (Though you can have multiple groups of interleved attributes)
*/
void
-cogl_vertex_buffer_add (CoglHandle handle,
- const char *attribute_name,
- guint8 n_components,
- GLenum gl_type,
- gboolean normalized,
- guint16 stride,
- const void *pointer);
+cogl_vertex_buffer_add (CoglHandle handle,
+ const char *attribute_name,
+ guint8 n_components,
+ CoglAttributeType type,
+ gboolean normalized,
+ guint16 stride,
+ const void *pointer);
/**
* cogl_vertex_buffer_delete:
@@ -226,21 +243,33 @@ void
cogl_vertex_buffer_enable (CoglHandle handle,
const char *attribute_name);
+/**
+ * CoglVerticesMode:
+ * COGL_VERTICES_MODE_POINTS:
+ * COGL_VERTICES_MODE_LINE_STRIP:
+ * COGL_VERTICES_MODE_LINE_LOOP:
+ * COGL_VERTICES_MODE_LINES:
+ * COGL_VERTICES_MODE_TRIANGLE_STRIP:
+ * COGL_VERTICES_MODE_TRIANGLE_FAN:
+ * COGL_VERTICES_MODE_TRIANGLES:
+ *
+ */
+typedef enum _CoglVerticesMode
+{
+ COGL_VERTICES_MODE_POINTS = GL_POINTS,
+ COGL_VERTICES_MODE_LINE_STRIP = GL_LINE_STRIP,
+ COGL_VERTICES_MODE_LINE_LOOP = GL_LINE_LOOP,
+ COGL_VERTICES_MODE_LINES = GL_LINES,
+ COGL_VERTICES_MODE_TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
+ COGL_VERTICES_MODE_TRIANGLE_FAN = GL_TRIANGLE_FAN,
+ COGL_VERTICES_MODE_TRIANGLES = GL_TRIANGLES
+} CoglVerticesMode;
+
/**
* cogl_vertex_buffer_draw:
* @handle: A vertex buffer handle
- * @mode: Specifies how the vertices should be interpreted, and should be
- * a valid GL primitive type:
- *
- * GL_POINTS
- * GL_LINE_STRIP
- * GL_LINE_LOOP
- * GL_LINES
- * GL_TRIANGLE_STRIP
- * GL_TRIANGLE_FAN
- * GL_TRIANGLES
- *
- * (Note: only types available in GLES are listed)
+ * @mode: A #CoglVerticesMode specifying how the vertices should be
+ * interpreted.
* @first: Specifies the index of the first vertex you want to draw with
* @count: Specifies the number of vertices you want to draw.
*
@@ -251,10 +280,10 @@ cogl_vertex_buffer_enable (CoglHandle handle,
* drawing.
*/
void
-cogl_vertex_buffer_draw (CoglHandle handle,
- GLenum mode,
- GLint first,
- GLsizei count);
+cogl_vertex_buffer_draw (CoglHandle handle,
+ CoglVerticesMode mode,
+ int first,
+ int count);
/**
* CoglIndicesType:
@@ -296,28 +325,19 @@ typedef enum _CoglIndicesType
* the indices and reduce the demand for memory bandwidth.
*/
void
-cogl_vertex_buffer_add_indices (CoglHandle handle,
- int id,
- unsigned int min_index,
- unsigned int max_index,
- CoglIndicesType indices_type,
- const void *indices_array,
- size_t indices_len);
+cogl_vertex_buffer_add_indices (CoglHandle handle,
+ int id,
+ int min_index,
+ int max_index,
+ CoglIndicesType indices_type,
+ const void *indices_array,
+ int indices_len);
/**
* cogl_vertex_buffer_draw_elements:
* @handle: A vertex buffer handle
- * @mode: Specifies how the vertices should be interpreted, and should be
- * a valid GL primitive type:
- *
- * GL_POINTS
- * GL_LINE_STRIP
- * GL_LINE_LOOP
- * GL_LINES
- * GL_TRIANGLE_STRIP
- * GL_TRIANGLE_FAN
- * GL_TRIANGLES
- *
+ * @mode: A #CoglVerticesMode specifying how the vertices should be
+ * interpreted.
* @indices_id: The identifier for a an array of indices previously added to
* the given Cogl vertex buffer using
* cogl_vertex_buffer_add_indices().
@@ -333,11 +353,11 @@ cogl_vertex_buffer_add_indices (CoglHandle handle,
* drawing.
*/
void
-cogl_vertex_buffer_draw_elements (CoglHandle handle,
- GLenum mode,
- int indices_id,
- unsigned int indices_offset,
- unsigned int count);
+cogl_vertex_buffer_draw_elements (CoglHandle handle,
+ CoglVerticesMode mode,
+ int indices_id,
+ int indices_offset,
+ int count);
/**
* cogl_vertex_buffer_ref:
diff --git a/clutter/cogl/common/cogl-vertex-buffer.c b/clutter/cogl/common/cogl-vertex-buffer.c
index cd450ea93..7c8269765 100644
--- a/clutter/cogl/common/cogl-vertex-buffer.c
+++ b/clutter/cogl/common/cogl-vertex-buffer.c
@@ -414,13 +414,13 @@ get_gl_type_size (CoglVertexBufferAttribFlags flags)
}
void
-cogl_vertex_buffer_add (CoglHandle handle,
- const char *attribute_name,
- guint8 n_components,
- GLenum gl_type,
- gboolean normalized,
- guint16 stride,
- const void *pointer)
+cogl_vertex_buffer_add (CoglHandle handle,
+ const char *attribute_name,
+ guint8 n_components,
+ CoglAttributeType type,
+ gboolean normalized,
+ guint16 stride,
+ const void *pointer)
{
CoglVertexBuffer *buffer;
GQuark name_quark = g_quark_from_string (attribute_name);
@@ -488,7 +488,7 @@ cogl_vertex_buffer_add (CoglHandle handle,
attribute->u.pointer = pointer;
attribute->texture_unit = texture_unit;
- flags |= get_attribute_gl_type_flag_from_gl_type (gl_type);
+ flags |= get_attribute_gl_type_flag_from_gl_type (type);
flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED;
/* Note: We currently just assume, if an attribute is *ever* updated
@@ -1719,10 +1719,10 @@ disable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
}
void
-cogl_vertex_buffer_draw (CoglHandle handle,
- GLenum mode,
- GLint first,
- GLsizei count)
+cogl_vertex_buffer_draw (CoglHandle handle,
+ CoglVerticesMode mode,
+ int first,
+ int count)
{
CoglVertexBuffer *buffer;
@@ -1772,13 +1772,13 @@ get_indices_type_size (GLuint indices_type)
}
void
-cogl_vertex_buffer_add_indices (CoglHandle handle,
- int id,
- unsigned int min_index,
- unsigned int max_index,
- CoglIndicesType indices_type,
- const void *indices_array,
- size_t indices_len)
+cogl_vertex_buffer_add_indices (CoglHandle handle,
+ int id,
+ int min_index,
+ int max_index,
+ CoglIndicesType indices_type,
+ const void *indices_array,
+ int indices_len)
{
CoglVertexBuffer *buffer;
GList *l;
@@ -1843,11 +1843,11 @@ cogl_vertex_buffer_add_indices (CoglHandle handle,
}
void
-cogl_vertex_buffer_draw_elements (CoglHandle handle,
- GLenum mode,
- int indices_id,
- unsigned int indices_offset,
- unsigned int count)
+cogl_vertex_buffer_draw_elements (CoglHandle handle,
+ CoglVerticesMode mode,
+ int indices_id,
+ int indices_offset,
+ int count)
{
CoglVertexBuffer *buffer;
gboolean fallback =
diff --git a/tests/interactive/test-cogl-vertex-buffer.c b/tests/interactive/test-cogl-vertex-buffer.c
index 5a0d45e31..8a3751665 100644
--- a/tests/interactive/test-cogl-vertex-buffer.c
+++ b/tests/interactive/test-cogl-vertex-buffer.c
@@ -139,7 +139,7 @@ on_paint (ClutterActor *actor, TestState *state)
{
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_vertex_buffer_draw_elements (state->buffer,
- GL_TRIANGLE_STRIP,
+ COGL_VERTICES_MODE_TRIANGLE_STRIP,
0, /* indices identifier */
0, /* indices offset */
state->n_static_indices);
@@ -287,7 +287,7 @@ init_quad_mesh (TestState *state)
cogl_vertex_buffer_add (state->buffer,
"gl_Vertex",
3, /* n components */
- GL_FLOAT,
+ COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
0, /* stride */
state->quad_mesh_verts);
@@ -295,7 +295,7 @@ init_quad_mesh (TestState *state)
cogl_vertex_buffer_add (state->buffer,
"gl_Color",
4, /* n components */
- GL_UNSIGNED_BYTE,
+ COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE,
FALSE, /* normalized */
0, /* stride */
state->quad_mesh_colors);