mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
[cogl-vertex-buffer] Seal GL types from the public API
We now have CoglAttributeType and CoglVerticesMode typedefs to replace the use of GLenum in the public API.
This commit is contained in:
parent
58b89eabdf
commit
e4d820b75d
@ -94,6 +94,24 @@ cogl_vertex_buffer_new (guint n_vertices);
|
|||||||
guint
|
guint
|
||||||
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
|
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:
|
* cogl_vertex_buffer_add:
|
||||||
* @handle: A vertex buffer handle
|
* @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.
|
* the name can have a detail component, E.g.
|
||||||
* "gl_Color::active" or "gl_Color::inactive"
|
* "gl_Color::active" or "gl_Color::inactive"
|
||||||
* @n_components: The number of components per attribute and must be 1,2,3 or 4
|
* @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,
|
* @type: a #CoglAttributeType specifying the data type of each component.
|
||||||
* GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT or GL_FLOAT)
|
|
||||||
* @normalized: If GL_TRUE, this specifies that values stored in an integer
|
* @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
|
* for unsigned values. If GL_FALSE they are converted to floats
|
||||||
* directly.
|
* directly.
|
||||||
* @stride: This specifies the number of bytes from the start of one attribute
|
* @stride: This specifies the number of bytes from the start of one attribute
|
||||||
@ -159,7 +176,7 @@ void
|
|||||||
cogl_vertex_buffer_add (CoglHandle handle,
|
cogl_vertex_buffer_add (CoglHandle handle,
|
||||||
const char *attribute_name,
|
const char *attribute_name,
|
||||||
guint8 n_components,
|
guint8 n_components,
|
||||||
GLenum gl_type,
|
CoglAttributeType type,
|
||||||
gboolean normalized,
|
gboolean normalized,
|
||||||
guint16 stride,
|
guint16 stride,
|
||||||
const void *pointer);
|
const void *pointer);
|
||||||
@ -226,21 +243,33 @@ void
|
|||||||
cogl_vertex_buffer_enable (CoglHandle handle,
|
cogl_vertex_buffer_enable (CoglHandle handle,
|
||||||
const char *attribute_name);
|
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:
|
* cogl_vertex_buffer_draw:
|
||||||
* @handle: A vertex buffer handle
|
* @handle: A vertex buffer handle
|
||||||
* @mode: Specifies how the vertices should be interpreted, and should be
|
* @mode: A #CoglVerticesMode specifying how the vertices should be
|
||||||
* a valid GL primitive type:
|
* interpreted.
|
||||||
* <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)
|
|
||||||
* @first: Specifies the index of the first vertex you want to draw with
|
* @first: Specifies the index of the first vertex you want to draw with
|
||||||
* @count: Specifies the number of vertices you want to draw.
|
* @count: Specifies the number of vertices you want to draw.
|
||||||
*
|
*
|
||||||
@ -252,9 +281,9 @@ cogl_vertex_buffer_enable (CoglHandle handle,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cogl_vertex_buffer_draw (CoglHandle handle,
|
cogl_vertex_buffer_draw (CoglHandle handle,
|
||||||
GLenum mode,
|
CoglVerticesMode mode,
|
||||||
GLint first,
|
int first,
|
||||||
GLsizei count);
|
int count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglIndicesType:
|
* CoglIndicesType:
|
||||||
@ -298,26 +327,17 @@ typedef enum _CoglIndicesType
|
|||||||
void
|
void
|
||||||
cogl_vertex_buffer_add_indices (CoglHandle handle,
|
cogl_vertex_buffer_add_indices (CoglHandle handle,
|
||||||
int id,
|
int id,
|
||||||
unsigned int min_index,
|
int min_index,
|
||||||
unsigned int max_index,
|
int max_index,
|
||||||
CoglIndicesType indices_type,
|
CoglIndicesType indices_type,
|
||||||
const void *indices_array,
|
const void *indices_array,
|
||||||
size_t indices_len);
|
int indices_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_vertex_buffer_draw_elements:
|
* cogl_vertex_buffer_draw_elements:
|
||||||
* @handle: A vertex buffer handle
|
* @handle: A vertex buffer handle
|
||||||
* @mode: Specifies how the vertices should be interpreted, and should be
|
* @mode: A #CoglVerticesMode specifying how the vertices should be
|
||||||
* a valid GL primitive type:
|
* interpreted.
|
||||||
* <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>
|
|
||||||
* @indices_id: The identifier for a an array of indices previously added to
|
* @indices_id: The identifier for a an array of indices previously added to
|
||||||
* the given Cogl vertex buffer using
|
* the given Cogl vertex buffer using
|
||||||
* cogl_vertex_buffer_add_indices().
|
* cogl_vertex_buffer_add_indices().
|
||||||
@ -334,10 +354,10 @@ cogl_vertex_buffer_add_indices (CoglHandle handle,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
||||||
GLenum mode,
|
CoglVerticesMode mode,
|
||||||
int indices_id,
|
int indices_id,
|
||||||
unsigned int indices_offset,
|
int indices_offset,
|
||||||
unsigned int count);
|
int count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_vertex_buffer_ref:
|
* cogl_vertex_buffer_ref:
|
||||||
|
@ -417,7 +417,7 @@ void
|
|||||||
cogl_vertex_buffer_add (CoglHandle handle,
|
cogl_vertex_buffer_add (CoglHandle handle,
|
||||||
const char *attribute_name,
|
const char *attribute_name,
|
||||||
guint8 n_components,
|
guint8 n_components,
|
||||||
GLenum gl_type,
|
CoglAttributeType type,
|
||||||
gboolean normalized,
|
gboolean normalized,
|
||||||
guint16 stride,
|
guint16 stride,
|
||||||
const void *pointer)
|
const void *pointer)
|
||||||
@ -488,7 +488,7 @@ cogl_vertex_buffer_add (CoglHandle handle,
|
|||||||
attribute->u.pointer = pointer;
|
attribute->u.pointer = pointer;
|
||||||
attribute->texture_unit = texture_unit;
|
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;
|
flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED;
|
||||||
|
|
||||||
/* Note: We currently just assume, if an attribute is *ever* updated
|
/* Note: We currently just assume, if an attribute is *ever* updated
|
||||||
@ -1720,9 +1720,9 @@ disable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_vertex_buffer_draw (CoglHandle handle,
|
cogl_vertex_buffer_draw (CoglHandle handle,
|
||||||
GLenum mode,
|
CoglVerticesMode mode,
|
||||||
GLint first,
|
int first,
|
||||||
GLsizei count)
|
int count)
|
||||||
{
|
{
|
||||||
CoglVertexBuffer *buffer;
|
CoglVertexBuffer *buffer;
|
||||||
|
|
||||||
@ -1774,11 +1774,11 @@ get_indices_type_size (GLuint indices_type)
|
|||||||
void
|
void
|
||||||
cogl_vertex_buffer_add_indices (CoglHandle handle,
|
cogl_vertex_buffer_add_indices (CoglHandle handle,
|
||||||
int id,
|
int id,
|
||||||
unsigned int min_index,
|
int min_index,
|
||||||
unsigned int max_index,
|
int max_index,
|
||||||
CoglIndicesType indices_type,
|
CoglIndicesType indices_type,
|
||||||
const void *indices_array,
|
const void *indices_array,
|
||||||
size_t indices_len)
|
int indices_len)
|
||||||
{
|
{
|
||||||
CoglVertexBuffer *buffer;
|
CoglVertexBuffer *buffer;
|
||||||
GList *l;
|
GList *l;
|
||||||
@ -1844,10 +1844,10 @@ cogl_vertex_buffer_add_indices (CoglHandle handle,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
||||||
GLenum mode,
|
CoglVerticesMode mode,
|
||||||
int indices_id,
|
int indices_id,
|
||||||
unsigned int indices_offset,
|
int indices_offset,
|
||||||
unsigned int count)
|
int count)
|
||||||
{
|
{
|
||||||
CoglVertexBuffer *buffer;
|
CoglVertexBuffer *buffer;
|
||||||
gboolean fallback =
|
gboolean fallback =
|
||||||
|
Loading…
Reference in New Issue
Block a user