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
* @attribute_name: The name of your attribute. It should be a valid GLSL
* 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
* (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:
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:
- * <itemizedlist>
- * <listitem>GL_POINTS</listitem>
- * <listitem>GL_LINE_STRIP</listitem>
- * <listitem>GL_LINE_LOOP</listitem>
- * <listitem>GL_LINES</listitem>
- * <listitem>GL_TRIANGLE_STRIP</listitem>
- * <listitem>GL_TRIANGLE_FAN</listitem>
- * <listitem>GL_TRIANGLES</listitem>
- * </itemizedlist>
- * (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.
*
* 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:
* 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:
- * <itemizedlist>
- * <listitem>GL_POINTS</listitem>
- * <listitem>GL_LINE_STRIP</listitem>
- * <listitem>GL_LINE_LOOP</listitem>
- * <listitem>GL_LINES</listitem>
- * <listitem>GL_TRIANGLE_STRIP</listitem>
- * <listitem>GL_TRIANGLE_FAN</listitem>
- * <listitem>GL_TRIANGLES</listitem>
- * </itemizedlist>
+ * @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().
* 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:
}
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);
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
}
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;
}
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;
}
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 =