mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
Allow using array of vertices even without textures
It's often nice to be able to draw a batch of vertices, even if these have no texture coordinates. This add a cogl_rectangles, similar to cogl_rectangles_with_texture_coords, only without.
This commit is contained in:
parent
5a06f1d1d0
commit
13e5bd9e8b
@ -477,6 +477,27 @@ void cogl_rectangle_with_multitexture_coords (float x1,
|
||||
void cogl_rectangles_with_texture_coords (const float *verts,
|
||||
guint n_rects);
|
||||
|
||||
/**
|
||||
* cogl_rectangles:
|
||||
* @verts: an array of vertices
|
||||
* @n_rects: number of rectangles to draw
|
||||
*
|
||||
* Draws a series of rectangles in the same way that
|
||||
* cogl_rectangle() does. In some situations it can give a
|
||||
* significant performance boost to use this function rather than
|
||||
* calling cogl_rectangle() separately for each rectangle.
|
||||
*
|
||||
* @verts should point to an array of #float<!-- -->s with
|
||||
* @n_rects * 8 elements. Each group of 4 values corresponds to the
|
||||
* parameters x1, y1, x2, and y2, and have the same
|
||||
* meaning as in cogl_rectangle().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_rectangles (const float *verts,
|
||||
guint n_rects);
|
||||
|
||||
|
||||
/**
|
||||
* cogl_polygon:
|
||||
* @vertices: An array of #CoglTextureVertex structs
|
||||
|
@ -2749,6 +2749,26 @@ _cogl_rectangles_with_multitexture_coords (
|
||||
_cogl_journal_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangles (const float *verts,
|
||||
guint n_rects)
|
||||
{
|
||||
struct _CoglMutiTexturedRect rects[n_rects];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i].x_1 = verts[i * 4];
|
||||
rects[i].y_1 = verts[i * 4 + 1];
|
||||
rects[i].x_2 = verts[i * 4 + 2];
|
||||
rects[i].y_2 = verts[i * 4 + 3];
|
||||
rects[i].tex_coords = NULL;
|
||||
rects[i].tex_coords_len = 0;
|
||||
}
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangles_with_texture_coords (const float *verts,
|
||||
guint n_rects)
|
||||
|
@ -2843,6 +2843,25 @@ _cogl_rectangles_with_multitexture_coords (
|
||||
|
||||
_cogl_journal_flush ();
|
||||
}
|
||||
void
|
||||
cogl_rectangles (const float *verts,
|
||||
guint n_rects)
|
||||
{
|
||||
struct _CoglMutiTexturedRect rects[n_rects];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i].x_1 = verts[i * 4];
|
||||
rects[i].y_1 = verts[i * 4 + 1];
|
||||
rects[i].x_2 = verts[i * 4 + 2];
|
||||
rects[i].y_2 = verts[i * 4 + 3];
|
||||
rects[i].tex_coords = NULL;
|
||||
rects[i].tex_coords_len = 0;
|
||||
}
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangles_with_texture_coords (const float *verts,
|
||||
|
Loading…
Reference in New Issue
Block a user