mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
[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:
parent
8aa80eb55f
commit
14d1c4a767
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user