2009-01-20 16:12:44 -05:00
|
|
|
/*
|
2009-04-27 10:48:12 -04:00
|
|
|
* Cogl
|
2009-01-20 16:12:44 -05:00
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
2009-01-20 16:12:44 -05:00
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
* Copyright (C) 2008,2009 Intel Corporation.
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 07:56:10 -05:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Robert Bragg <robert@linux.intel.com>
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
|
|
#error "Only <cogl/cogl.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2009-01-20 16:12:44 -05:00
|
|
|
#ifndef __COGL_VERTEX_BUFFER_H__
|
|
|
|
#define __COGL_VERTEX_BUFFER_H__
|
2008-11-10 13:53:14 -05:00
|
|
|
|
|
|
|
#include <glib.h>
|
2010-07-03 21:44:37 -04:00
|
|
|
#include <cogl/cogl-defines.h>
|
2008-11-10 13:53:14 -05:00
|
|
|
#include <cogl/cogl-types.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
/**
|
2009-01-20 16:12:44 -05:00
|
|
|
* SECTION:cogl-vertex-buffer
|
2008-11-10 13:53:14 -05:00
|
|
|
* @short_description: An API for submitting extensible arrays of vertex
|
2009-11-19 08:55:10 -05:00
|
|
|
* attributes to be mapped into the GPU for fast drawing.
|
2009-02-06 06:16:42 -05:00
|
|
|
*
|
|
|
|
* For example to describe a textured triangle, you could create a new cogl
|
|
|
|
* vertex buffer with 3 vertices, and then you might add 2 attributes for each
|
|
|
|
* vertex:
|
|
|
|
* <orderedlist>
|
|
|
|
* <listitem>
|
|
|
|
* a "gl_Position" describing the (x,y,z) position for each vertex.
|
|
|
|
* </listitem>
|
|
|
|
* <listitem>
|
|
|
|
* a "gl_MultiTexCoord0" describing the (tx,ty) texture coordinates for each
|
|
|
|
* vertex.
|
|
|
|
* </listitem>
|
|
|
|
* </orderedlist>
|
|
|
|
*
|
|
|
|
* The Vertex Buffer API is designed to be a fairly raw mechanism for
|
2009-01-20 16:12:44 -05:00
|
|
|
* developers to be able to submit geometry to Cogl in a format that can be
|
2009-02-06 06:16:42 -05:00
|
|
|
* directly consumed by an OpenGL driver and mapped into your GPU for fast
|
|
|
|
* re-use. It is designed to avoid repeated validation of the attributes by the
|
2009-02-28 12:36:25 -05:00
|
|
|
* driver; to minimize transport costs (e.g. considering indirect GLX
|
|
|
|
* use-cases) and to potentially avoid repeated format conversions when
|
|
|
|
* attributes are supplied in a format that is not natively supported by the
|
|
|
|
* GPU.
|
2009-02-06 06:16:42 -05:00
|
|
|
*
|
|
|
|
* Although this API does allow you to modify attributes after they have been
|
|
|
|
* submitted to the GPU you should be aware that modification is not that
|
|
|
|
* cheap, since it implies validating the new data and potentially the
|
|
|
|
* OpenGL driver will need to reformat it for the GPU.
|
|
|
|
*
|
|
|
|
* If at all possible think of tricks that let you re-use static attributes,
|
|
|
|
* and if you do need to repeatedly update attributes (e.g. for some kind of
|
|
|
|
* morphing geometry) then only update and re-submit the specific attributes
|
|
|
|
* that have changed.
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2009-01-20 16:12:44 -05:00
|
|
|
* cogl_vertex_buffer_new:
|
|
|
|
* @n_vertices: The number of vertices that your attributes will correspond to.
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
2009-06-10 07:50:45 -04:00
|
|
|
* Creates a new vertex buffer that you can use to add attributes.
|
|
|
|
*
|
|
|
|
* Return value: a new #CoglHandle
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
CoglHandle
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
cogl_vertex_buffer_new (unsigned int n_vertices);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
2009-02-28 12:39:38 -05:00
|
|
|
/**
|
|
|
|
* cogl_vertex_buffer_get_n_vertices:
|
|
|
|
* @handle: A vertex buffer handle
|
|
|
|
*
|
2009-06-10 07:50:45 -04:00
|
|
|
* Retrieves the number of vertices that @handle represents
|
|
|
|
*
|
|
|
|
* Return value: the number of vertices
|
2009-02-28 12:39:38 -05:00
|
|
|
*/
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
unsigned int
|
2009-02-28 12:39:38 -05:00
|
|
|
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
|
|
|
|
|
2008-11-10 13:53:14 -05:00
|
|
|
/**
|
2009-01-20 16:12:44 -05:00
|
|
|
* cogl_vertex_buffer_add:
|
|
|
|
* @handle: A vertex buffer handle
|
2008-11-10 13:53:14 -05:00
|
|
|
* @attribute_name: The name of your attribute. It should be a valid GLSL
|
2009-11-19 08:55:10 -05:00
|
|
|
* variable name and standard attribute types must use one of following
|
|
|
|
* built-in names: (Note: they correspond to the built-in names of GLSL)
|
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem>"gl_Color"</listitem>
|
|
|
|
* <listitem>"gl_Normal"</listitem>
|
|
|
|
* <listitem>"gl_MultiTexCoord0, gl_MultiTexCoord1, ..."</listitem>
|
|
|
|
* <listitem>"gl_Vertex"</listitem>
|
|
|
|
* </itemizedlist>
|
|
|
|
* To support adding multiple variations of the same attribute 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
|
2009-05-24 06:33:29 -04:00
|
|
|
* @type: a #CoglAttributeType specifying the data type of each component.
|
2009-11-19 08:55:10 -05:00
|
|
|
* @normalized: If %TRUE, this specifies that values stored in an integer
|
|
|
|
* format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0]
|
|
|
|
* for unsigned values. If %FALSE they are converted to floats
|
|
|
|
* directly.
|
2008-11-10 13:53:14 -05:00
|
|
|
* @stride: This specifies the number of bytes from the start of one attribute
|
2009-11-19 08:55:10 -05:00
|
|
|
* value to the start of the next value (for the same attribute). So, for
|
|
|
|
* example, with a position interleved with color like this:
|
|
|
|
* XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the
|
|
|
|
* stride for both attributes is 6. The special value 0 means the
|
|
|
|
* values are stored sequentially in memory.
|
|
|
|
* @pointer: This addresses the first attribute in the vertex array. This
|
|
|
|
* must remain valid until you either call cogl_vertex_buffer_submit() or
|
|
|
|
* issue a draw call.
|
|
|
|
*
|
|
|
|
* Adds an attribute to a buffer.
|
|
|
|
*
|
|
|
|
* You either can use one of the built-in names such as "gl_Vertex", or
|
|
|
|
* "gl_MultiTexCoord0" to add standard attributes, like positions, colors
|
|
|
|
* and normals, or you can add custom attributes for use in shaders.
|
2009-02-06 06:16:42 -05:00
|
|
|
*
|
|
|
|
* The number of vertices declared when calling cogl_vertex_buffer_new()
|
2009-11-19 08:55:10 -05:00
|
|
|
* determines how many attribute values will be read from the supplied
|
|
|
|
* @pointer.
|
2009-02-06 06:16:42 -05:00
|
|
|
*
|
|
|
|
* The data for your attribute isn't copied anywhere until you call
|
2009-11-19 08:55:10 -05:00
|
|
|
* cogl_vertex_buffer_submit(), or issue a draw call which automatically
|
|
|
|
* submits pending attribute changes. so the supplied pointer must remain
|
2009-02-28 12:36:25 -05:00
|
|
|
* valid until then. If you are updating an existing attribute (done by
|
2009-11-19 08:55:10 -05:00
|
|
|
* re-adding it) then you still need to re-call cogl_vertex_buffer_submit()
|
|
|
|
* to commit the changes to the GPU. Be carefull to minimize the number
|
|
|
|
* of calls to cogl_vertex_buffer_submit(), though.
|
2009-02-28 12:36:25 -05:00
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* <note>If you are interleving attributes it is assumed that each interleaved
|
2009-02-28 12:36:25 -05:00
|
|
|
* attribute starts no farther than +- stride bytes from the other attributes
|
|
|
|
* it is interleved with. I.e. this is ok:
|
2009-02-06 06:16:42 -05:00
|
|
|
* <programlisting>
|
2008-11-10 13:53:14 -05:00
|
|
|
* |-0-0-0-0-0-0-0-0-0-0|
|
2009-02-06 06:16:42 -05:00
|
|
|
* </programlisting>
|
2008-11-10 13:53:14 -05:00
|
|
|
* This is not ok:
|
2009-02-06 06:16:42 -05:00
|
|
|
* <programlisting>
|
2008-11-10 13:53:14 -05:00
|
|
|
* |- - - - -0-0-0-0-0-0 0 0 0 0|
|
2009-02-06 06:16:42 -05:00
|
|
|
* </programlisting>
|
2009-11-19 08:55:10 -05:00
|
|
|
* (Though you can have multiple groups of interleved attributes)</note>
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
void
|
2009-05-24 06:33:29 -04:00
|
|
|
cogl_vertex_buffer_add (CoglHandle handle,
|
|
|
|
const char *attribute_name,
|
|
|
|
guint8 n_components,
|
|
|
|
CoglAttributeType type,
|
|
|
|
gboolean normalized,
|
|
|
|
guint16 stride,
|
|
|
|
const void *pointer);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
|
|
|
/**
|
2009-01-20 16:12:44 -05:00
|
|
|
* cogl_vertex_buffer_delete:
|
|
|
|
* @handle: A vertex buffer handle
|
2008-11-10 13:53:14 -05:00
|
|
|
* @attribute_name: The name of a previously added attribute
|
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* Deletes an attribute from a buffer. You will need to call
|
|
|
|
* cogl_vertex_buffer_submit() or issue a draw call to commit this
|
2009-02-28 12:36:25 -05:00
|
|
|
* change to the GPU.
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
void
|
2009-01-20 16:12:44 -05:00
|
|
|
cogl_vertex_buffer_delete (CoglHandle handle,
|
|
|
|
const char *attribute_name);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
|
|
|
/**
|
2009-02-06 06:16:42 -05:00
|
|
|
* cogl_vertex_buffer_submit:
|
2009-01-20 16:12:44 -05:00
|
|
|
* @handle: A vertex buffer handle
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* Submits all the user added attributes to the GPU; once submitted, the
|
|
|
|
* attributes can be used for drawing.
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
2009-02-06 06:16:42 -05:00
|
|
|
* You should aim to minimize calls to this function since it implies
|
|
|
|
* validating your data; it potentially incurs a transport cost (especially if
|
|
|
|
* you are using GLX indirect rendering) and potentially a format conversion
|
|
|
|
* cost if the GPU doesn't natively support any of the given attribute formats.
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
void
|
2009-02-06 06:16:42 -05:00
|
|
|
cogl_vertex_buffer_submit (CoglHandle handle);
|
2009-01-20 16:12:44 -05:00
|
|
|
|
|
|
|
/**
|
2009-02-06 06:16:42 -05:00
|
|
|
* cogl_vertex_buffer_disable:
|
2009-01-20 16:12:44 -05:00
|
|
|
* @handle: A vertex buffer handle
|
2009-02-06 06:16:42 -05:00
|
|
|
* @attribute_name: The name of the attribute you want to disable
|
2009-01-20 16:12:44 -05:00
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* Disables a previosuly added attribute.
|
2009-01-20 16:12:44 -05:00
|
|
|
*
|
2009-02-06 06:16:42 -05:00
|
|
|
* Since it can be costly to add and remove new attributes to buffers; to make
|
|
|
|
* individual buffers more reuseable it is possible to enable and disable
|
|
|
|
* attributes before using a buffer for drawing.
|
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* You don't need to call cogl_vertex_buffer_submit() after using this
|
|
|
|
* function.
|
2009-01-20 16:12:44 -05:00
|
|
|
*/
|
|
|
|
void
|
2009-02-06 06:16:42 -05:00
|
|
|
cogl_vertex_buffer_disable (CoglHandle handle,
|
|
|
|
const char *attribute_name);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
|
|
|
/**
|
2009-02-06 06:16:42 -05:00
|
|
|
* cogl_vertex_buffer_enable:
|
2009-01-20 16:12:44 -05:00
|
|
|
* @handle: A vertex buffer handle
|
2009-02-06 06:16:42 -05:00
|
|
|
* @attribute_name: The name of the attribute you want to enable
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* Enables a previosuly disabled attribute.
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
2009-01-20 16:12:44 -05:00
|
|
|
* Since it can be costly to add and remove new attributes to buffers; to make
|
|
|
|
* individual buffers more reuseable it is possible to enable and disable
|
|
|
|
* attributes before using a buffer for drawing.
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
2009-02-06 06:16:42 -05:00
|
|
|
* You don't need to call cogl_vertex_buffer_submit() after using this function
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
void
|
2009-02-06 06:16:42 -05:00
|
|
|
cogl_vertex_buffer_enable (CoglHandle handle,
|
|
|
|
const char *attribute_name);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
|
|
|
/**
|
2009-01-20 16:12:44 -05:00
|
|
|
* cogl_vertex_buffer_draw:
|
|
|
|
* @handle: A vertex buffer handle
|
2009-05-24 06:33:29 -04:00
|
|
|
* @mode: A #CoglVerticesMode specifying how the vertices should be
|
2009-11-19 08:55:10 -05:00
|
|
|
* interpreted.
|
2008-11-10 13:53:14 -05:00
|
|
|
* @first: Specifies the index of the first vertex you want to draw with
|
|
|
|
* @count: Specifies the number of vertices you want to draw.
|
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* Allows you to draw geometry using all or a subset of the
|
2009-01-20 16:12:44 -05:00
|
|
|
* vertices in a vertex buffer.
|
2009-02-28 12:36:25 -05:00
|
|
|
*
|
|
|
|
* Any un-submitted attribute changes are automatically submitted before
|
|
|
|
* drawing.
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
void
|
2009-05-24 06:33:29 -04:00
|
|
|
cogl_vertex_buffer_draw (CoglHandle handle,
|
|
|
|
CoglVerticesMode mode,
|
|
|
|
int first,
|
|
|
|
int count);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
2009-05-23 23:04:38 -04:00
|
|
|
/**
|
2009-05-28 07:49:29 -04:00
|
|
|
* cogl_vertex_buffer_indices_new:
|
2009-05-23 23:04:38 -04:00
|
|
|
* @indices_type: a #CoglIndicesType specifying the data type used for
|
2009-11-19 08:55:10 -05:00
|
|
|
* the indices.
|
|
|
|
* @indices_array: (array length=indices_len): Specifies the address of
|
|
|
|
* your array of indices
|
2009-05-23 23:04:38 -04:00
|
|
|
* @indices_len: The number of indices in indices_array
|
|
|
|
*
|
|
|
|
* Depending on how much geometry you are submitting it can be worthwhile
|
|
|
|
* optimizing the number of redundant vertices you submit. Using an index
|
|
|
|
* array allows you to reference vertices multiple times, for example
|
|
|
|
* during triangle strips.
|
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* Return value: A CoglHandle for the indices which you can pass to
|
|
|
|
* cogl_vertex_buffer_draw_elements().
|
2009-05-23 23:04:38 -04:00
|
|
|
*/
|
2009-05-28 07:49:29 -04:00
|
|
|
CoglHandle
|
|
|
|
cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
|
2009-05-24 06:33:29 -04:00
|
|
|
const void *indices_array,
|
|
|
|
int indices_len);
|
2009-05-23 23:04:38 -04:00
|
|
|
|
2009-06-17 10:03:33 -04:00
|
|
|
/**
|
|
|
|
* cogl_vertex_buffer_indices_get_type:
|
2010-12-22 04:42:41 -05:00
|
|
|
* @indices: An indices handle
|
2009-06-17 10:03:33 -04:00
|
|
|
*
|
|
|
|
* Queries back the data type used for the given indices
|
|
|
|
*
|
|
|
|
* Returns: The CoglIndicesType used
|
|
|
|
*/
|
|
|
|
CoglIndicesType
|
|
|
|
cogl_vertex_buffer_indices_get_type (CoglHandle indices);
|
|
|
|
|
2008-11-10 13:53:14 -05:00
|
|
|
/**
|
2009-03-25 10:53:58 -04:00
|
|
|
* cogl_vertex_buffer_draw_elements:
|
2009-01-20 16:12:44 -05:00
|
|
|
* @handle: A vertex buffer handle
|
2009-05-24 06:33:29 -04:00
|
|
|
* @mode: A #CoglVerticesMode specifying how the vertices should be
|
2009-11-19 08:55:10 -05:00
|
|
|
* interpreted.
|
2009-05-28 07:49:29 -04:00
|
|
|
* @indices: A CoglHandle for a set of indices allocated via
|
2009-11-19 08:55:10 -05:00
|
|
|
* cogl_vertex_buffer_indices_new ()
|
2009-05-28 07:49:29 -04:00
|
|
|
* @min_index: Specifies the minimum vertex index contained in indices
|
|
|
|
* @max_index: Specifies the maximum vertex index contained in indices
|
2009-05-23 23:04:38 -04:00
|
|
|
* @indices_offset: An offset into named indices. The offset marks the first
|
2009-11-19 08:55:10 -05:00
|
|
|
* index to use for drawing.
|
2008-11-10 13:53:14 -05:00
|
|
|
* @count: Specifies the number of vertices you want to draw.
|
|
|
|
*
|
|
|
|
* This function lets you use an array of indices to specify the vertices
|
2009-05-23 23:04:38 -04:00
|
|
|
* within your vertex buffer that you want to draw. The indices themselves
|
2009-05-28 07:49:29 -04:00
|
|
|
* are created by calling cogl_vertex_buffer_indices_new ()
|
2009-02-28 12:36:25 -05:00
|
|
|
*
|
|
|
|
* Any un-submitted attribute changes are automatically submitted before
|
|
|
|
* drawing.
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
|
|
|
void
|
2009-05-24 06:33:29 -04:00
|
|
|
cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
|
|
|
CoglVerticesMode mode,
|
2009-05-28 07:49:29 -04:00
|
|
|
CoglHandle indices,
|
|
|
|
int min_index,
|
|
|
|
int max_index,
|
2009-05-24 06:33:29 -04:00
|
|
|
int indices_offset,
|
|
|
|
int count);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
2009-11-19 08:55:10 -05:00
|
|
|
#ifndef COGL_DISABLE_DEPRECATED
|
|
|
|
|
2008-11-12 05:55:06 -05:00
|
|
|
/**
|
2009-01-20 16:12:44 -05:00
|
|
|
* cogl_vertex_buffer_ref:
|
2008-11-10 13:53:14 -05:00
|
|
|
* @handle: a @CoglHandle.
|
|
|
|
*
|
2009-01-20 16:12:44 -05:00
|
|
|
* Increment the reference count for a vertex buffer
|
2008-11-10 13:53:14 -05:00
|
|
|
*
|
2009-11-19 08:55:10 -05:00
|
|
|
* Return value: the @handle.
|
|
|
|
*
|
|
|
|
* Deprecated: 1.2: Use cogl_handle_ref() instead
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
2009-01-20 16:12:44 -05:00
|
|
|
CoglHandle
|
2010-02-10 17:47:49 -05:00
|
|
|
cogl_vertex_buffer_ref (CoglHandle handle) G_GNUC_DEPRECATED;
|
2008-11-10 13:53:14 -05:00
|
|
|
|
|
|
|
/**
|
2009-01-20 16:12:44 -05:00
|
|
|
* cogl_vertex_buffer_unref:
|
2008-11-10 13:53:14 -05:00
|
|
|
* @handle: a @CoglHandle.
|
|
|
|
*
|
2009-01-20 16:12:44 -05:00
|
|
|
* Decrement the reference count for a vertex buffer
|
2009-11-19 08:55:10 -05:00
|
|
|
*
|
|
|
|
* Deprecated: 1.2: Use cogl_handle_unref() instead
|
2008-11-10 13:53:14 -05:00
|
|
|
*/
|
2009-01-20 16:12:44 -05:00
|
|
|
void
|
2010-02-10 17:47:49 -05:00
|
|
|
cogl_vertex_buffer_unref (CoglHandle handle) G_GNUC_DEPRECATED;
|
2008-11-10 13:53:14 -05:00
|
|
|
|
2009-11-19 08:55:10 -05:00
|
|
|
#endif /* COGL_DISABLE_DEPRECATED */
|
|
|
|
|
2009-05-28 08:47:18 -04:00
|
|
|
/**
|
|
|
|
* cogl_vertex_buffer_indices_get_for_quads:
|
|
|
|
* @n_indices: the number of indices in the vertex buffer.
|
|
|
|
*
|
|
|
|
* Creates a vertex buffer containing the indices needed to draw pairs
|
|
|
|
* of triangles from a list of vertices grouped as quads. There will
|
|
|
|
* be at least @n_indices entries in the buffer (but there may be
|
|
|
|
* more).
|
|
|
|
*
|
|
|
|
* The indices will follow this pattern:
|
|
|
|
*
|
|
|
|
* 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc
|
|
|
|
*
|
2010-07-02 11:19:48 -04:00
|
|
|
* For example, if you submit vertices for a quad like like that shown
|
|
|
|
* in <xref linkend="quad-indices-order"/> then you can request 6
|
|
|
|
* indices to render two triangles like those shown in <xref
|
|
|
|
* linkend="quad-indices-triangles"/>.
|
|
|
|
*
|
|
|
|
* <figure id="quad-indices-order">
|
|
|
|
* <title>Example of vertices submitted to form a quad</title>
|
|
|
|
* <graphic fileref="quad-indices-order.png" format="PNG"/>
|
|
|
|
* </figure>
|
|
|
|
*
|
|
|
|
* <figure id="quad-indices-triangles">
|
|
|
|
* <title>Illustration of the triangle indices that will be generated</title>
|
|
|
|
* <graphic fileref="quad-indices-triangles.png" format="PNG"/>
|
|
|
|
* </figure>
|
2009-05-28 08:47:18 -04:00
|
|
|
*
|
|
|
|
* Returns: A %CoglHandle containing the indices. The handled is
|
|
|
|
* owned by Cogl and should not be modified or unref'd.
|
|
|
|
*/
|
|
|
|
CoglHandle
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices);
|
2008-11-10 13:53:14 -05:00
|
|
|
|
2009-08-04 06:10:55 -04:00
|
|
|
/**
|
|
|
|
* cogl_is_vertex_buffer:
|
|
|
|
* @handle: a #CoglHandle for a vertex buffer object
|
|
|
|
*
|
|
|
|
* Checks whether @handle is a Vertex Buffer Object
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the handle is a VBO, and %FALSE
|
|
|
|
* otherwise
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
gboolean
|
2009-08-04 06:38:48 -04:00
|
|
|
cogl_is_vertex_buffer (CoglHandle handle);
|
2009-08-04 06:10:55 -04:00
|
|
|
|
2010-07-09 13:24:28 -04:00
|
|
|
/**
|
|
|
|
* cogl_is_vertex_buffer_indices:
|
|
|
|
* @handle: a #CoglHandle
|
|
|
|
*
|
|
|
|
* Checks whether @handle is a handle to the indices for a vertex
|
|
|
|
* buffer object
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the handle is indices, and %FALSE
|
|
|
|
* otherwise
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
cogl_is_vertex_buffer_indices (CoglHandle handle);
|
|
|
|
|
2008-11-10 13:53:14 -05:00
|
|
|
G_END_DECLS
|
|
|
|
|
2009-01-20 16:12:44 -05:00
|
|
|
#endif /* __COGL_VERTEX_BUFFER_H__ */
|