1
0
Fork 0

[vertex-buffer] Add cogl_vertex_buffer_indices_get_type API

cogl_vertex_buffer_indices lets you query back the data type used for the
given indices handle.
This commit is contained in:
Robert Bragg 2009-06-17 15:03:33 +01:00
parent 8aa80eb55f
commit 14d1c4a767
2 changed files with 32 additions and 0 deletions

View file

@ -332,6 +332,17 @@ cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
const void *indices_array,
int indices_len);
/**
* cogl_vertex_buffer_indices_get_type:
* @handle: An indices handle
*
* Queries back the data type used for the given indices
*
* Returns: The CoglIndicesType used
*/
CoglIndicesType
cogl_vertex_buffer_indices_get_type (CoglHandle indices);
/**
* cogl_vertex_buffer_delete_indices:
* @handle: A vertex buffer handle

View file

@ -1802,6 +1802,27 @@ cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
return _cogl_vertex_buffer_indices_handle_new (indices);
}
CoglIndicesType
cogl_vertex_buffer_indices_get_type (CoglHandle indices_handle)
{
CoglVertexBufferIndices *indices = NULL;
if (!cogl_is_vertex_buffer_indices (indices_handle))
return COGL_INDICES_TYPE_UNSIGNED_SHORT;
indices = _cogl_vertex_buffer_indices_pointer_from_handle (indices_handle);
if (indices->type == GL_UNSIGNED_BYTE)
return COGL_INDICES_TYPE_UNSIGNED_BYTE;
else if (indices->type == GL_UNSIGNED_SHORT)
return COGL_INDICES_TYPE_UNSIGNED_SHORT;
else
{
g_critical ("unknown indices type %d", indices->type);
return COGL_INDICES_TYPE_UNSIGNED_SHORT;
}
}
void
_cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *indices)
{