mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
[cogl-vertex-buffer] Allow querying back the number of vertices a buffer represents
This may be convenient e.g. at draw time if you are simply drawing all vertices
This commit is contained in:
parent
075ae9c4a7
commit
14e6323554
@ -84,6 +84,15 @@ G_BEGIN_DECLS
|
||||
CoglHandle
|
||||
cogl_vertex_buffer_new (guint n_vertices);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_get_n_vertices:
|
||||
* @handle: A vertex buffer handle
|
||||
*
|
||||
* This returns the number of vertices that @handle represents
|
||||
*/
|
||||
guint
|
||||
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_add:
|
||||
* @handle: A vertex buffer handle
|
||||
|
@ -221,6 +221,19 @@ cogl_vertex_buffer_new (guint n_vertices)
|
||||
return _cogl_vertex_buffer_handle_new (buffer);
|
||||
}
|
||||
|
||||
guint
|
||||
cogl_vertex_buffer_get_n_vertices (CoglHandle handle)
|
||||
{
|
||||
CoglVertexBuffer *buffer;
|
||||
|
||||
if (!cogl_is_vertex_buffer (handle))
|
||||
return 0;
|
||||
|
||||
buffer = _cogl_vertex_buffer_pointer_from_handle (handle);
|
||||
|
||||
return buffer->n_vertices;
|
||||
}
|
||||
|
||||
/* There are a number of standard OpenGL attributes that we deal with
|
||||
* specially. These attributes are all namespaced with a "gl_" prefix
|
||||
* so we should catch any typos instead of silently adding a custom
|
||||
|
@ -298,6 +298,7 @@ cogl_color_get_alpha_float
|
||||
<FILE>cogl-vertex-buffer</FILE>
|
||||
<TITLE>Vertex Buffers</TITLE>
|
||||
cogl_vertex_buffer_new
|
||||
cogl_vertex_buffer_get_n_vertices
|
||||
cogl_vertex_buffer_ref
|
||||
cogl_vertex_buffer_unref
|
||||
cogl_vertex_buffer_add
|
||||
|
Loading…
Reference in New Issue
Block a user