4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2010 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library. If not, see <http://www.gnu.org/licenses/>.
24 * Robert Bragg <robert@linux.intel.com>
27 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
28 #error "Only <cogl/cogl.h> can be included directly."
31 #ifndef __COGL_PRIMITIVE_H__
32 #define __COGL_PRIMITIVE_H__
34 /* We forward declare the CoglPrimitive type here to avoid some circular
35 * dependency issues with the following headers.
37 typedef struct _CoglPrimitive CoglPrimitive;
39 #include <cogl/cogl-vertex-buffer.h> /* for CoglVerticesMode */
40 #include <cogl/cogl-attribute.h>
45 * SECTION:cogl-primitive
46 * @short_description: Functions for creating, manipulating and drawing
54 * @x: The x component of a position attribute
55 * @y: The y component of a position attribute
57 * A convenience vertex definition that can be used with
58 * cogl_primitive_new_with_v2_attributes().
70 * @x: The x component of a position attribute
71 * @y: The y component of a position attribute
72 * @z: The z component of a position attribute
74 * A convenience vertex definition that can be used with
75 * cogl_primitive_new_with_v3_attributes().
87 * @x: The x component of a position attribute
88 * @y: The y component of a position attribute
89 * @r: The red component of a color attribute
90 * @b: The green component of a color attribute
91 * @g: The blue component of a color attribute
92 * @a: The alpha component of a color attribute
94 * A convenience vertex definition that can be used with
95 * cogl_primitive_new_with_v2c4_attributes().
108 * @x: The x component of a position attribute
109 * @y: The y component of a position attribute
110 * @z: The z component of a position attribute
111 * @r: The red component of a color attribute
112 * @b: The green component of a color attribute
113 * @g: The blue component of a color attribute
114 * @a: The alpha component of a color attribute
116 * A convenience vertex definition that can be used with
117 * cogl_primitive_new_with_v3c4_attributes().
120 * Stability: Unstable
130 * @x: The x component of a position attribute
131 * @y: The y component of a position attribute
132 * @s: The s component of a texture coordinate attribute
133 * @t: The t component of a texture coordinate attribute
135 * A convenience vertex definition that can be used with
136 * cogl_primitive_new_with_v2t2_attributes().
139 * Stability: Unstable
149 * @x: The x component of a position attribute
150 * @y: The y component of a position attribute
151 * @z: The z component of a position attribute
152 * @s: The s component of a texture coordinate attribute
153 * @t: The t component of a texture coordinate attribute
155 * A convenience vertex definition that can be used with
156 * cogl_primitive_new_with_v3t2_attributes().
159 * Stability: Unstable
170 * @x: The x component of a position attribute
171 * @y: The y component of a position attribute
172 * @s: The s component of a texture coordinate attribute
173 * @t: The t component of a texture coordinate attribute
174 * @r: The red component of a color attribute
175 * @b: The green component of a color attribute
176 * @g: The blue component of a color attribute
177 * @a: The alpha component of a color attribute
179 * A convenience vertex definition that can be used with
180 * cogl_primitive_new_with_v3t2c4_attributes().
183 * Stability: Unstable
194 * @x: The x component of a position attribute
195 * @y: The y component of a position attribute
196 * @z: The z component of a position attribute
197 * @s: The s component of a texture coordinate attribute
198 * @t: The t component of a texture coordinate attribute
199 * @r: The red component of a color attribute
200 * @b: The green component of a color attribute
201 * @g: The blue component of a color attribute
202 * @a: The alpha component of a color attribute
204 * A convenience vertex definition that can be used with
205 * cogl_primitive_new_with_v3t2c4_attributes().
208 * Stability: Unstable
218 * cogl_primitive_new:
219 * @mode: A #CoglVerticesMode defining how to draw the vertices
220 * @n_vertices: The number of vertices to process when drawing
221 * @Varargs: A %NULL terminated list of attributes
223 * Combines a set of #CoglAttribute<!-- -->s with a specific draw @mode
224 * and defines a vertex count so a #CoglPrimitive object can be retained and
225 * drawn later with no addition information required.
227 * The value passed as @n_vertices will simply update the
228 * #CoglPrimitive::n_vertices property as if
229 * cogl_primitive_set_n_vertices() were called. This property defines
230 * the number of vertices to read when drawing.
232 * Returns: A newly allocated #CoglPrimitive object
235 * Stability: Unstable
238 cogl_primitive_new (CoglVerticesMode mode,
243 cogl_primitive_new_with_attributes (CoglVerticesMode mode,
245 CoglAttribute **attributes,
249 * cogl_primitive_new_p2:
250 * @context: A #CoglContext
251 * @mode: A #CoglVerticesMode defining how to draw the vertices
252 * @n_vertices: The number of vertices to read from @data and also
253 * the number of vertices to read when later drawing.
254 * @data: An array of #CoglVertexP2 vertices
256 * Provides a convenient way to describe a primitive, such as a single
257 * triangle strip or a triangle fan, that will internally allocate the
258 * necessary #CoglAttributeBuffer storage, describe the position
259 * attribute with a #CoglAttribute and upload your data.
261 * For example to draw a convex polygon you can do:
263 * CoglVertexP2 triangle[] =
269 * prim = cogl_primitive_new_p2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
271 * cogl_primitive_draw (prim);
274 * The value passed as @n_vertices is initially used to determine how
275 * much can be read from @data but it will also be used to update the
276 * #CoglPrimitive::n_vertices property as if
277 * cogl_primitive_set_n_vertices() were called. This property defines
278 * the number of vertices to read when drawing.
280 * <note>The primitive API doesn't support drawing with sliced
281 * textures (since switching between slices implies changing state and
282 * so that implies multiple primitives need to be submitted). You
283 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
284 * might be used while drawing with this API. If your hardware doesn't
285 * support non-power of two textures (For example you are using GLES
286 * 1.1) then you will need to make sure your assets are resized to a
287 * power-of-two size (though they don't have to be square)</note>
289 * Return value: A newly allocated #CoglPrimitive with a reference of
290 * 1. This can be freed using cogl_object_unref().
293 * Stability: Unstable
296 cogl_primitive_new_p2 (CoglContext *context,
297 CoglVerticesMode mode,
299 const CoglVertexP2 *data);
302 * cogl_primitive_new_p3:
303 * @context: A #CoglContext
304 * @mode: A #CoglVerticesMode defining how to draw the vertices
305 * @n_vertices: The number of vertices to read from @data and also
306 * the number of vertices to read when later drawing.
307 * @data: An array of #CoglVertexP3 vertices
309 * Provides a convenient way to describe a primitive, such as a single
310 * triangle strip or a triangle fan, that will internally allocate the
311 * necessary #CoglAttributeBuffer storage, describe the position
312 * attribute with a #CoglAttribute and upload your data.
314 * For example to draw a convex polygon you can do:
316 * CoglVertexP3 triangle[] =
322 * prim = cogl_primitive_new_p3 (COGL_VERTICES_MODE_TRIANGLE_FAN,
324 * cogl_primitive_draw (prim);
327 * The value passed as @n_vertices is initially used to determine how
328 * much can be read from @data but it will also be used to update the
329 * #CoglPrimitive::n_vertices property as if
330 * cogl_primitive_set_n_vertices() were called. This property defines
331 * the number of vertices to read when drawing.
333 * <note>The primitive API doesn't support drawing with sliced
334 * textures (since switching between slices implies changing state and
335 * so that implies multiple primitives need to be submitted). You
336 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
337 * might be used while drawing with this API. If your hardware doesn't
338 * support non-power of two textures (For example you are using GLES
339 * 1.1) then you will need to make sure your assets are resized to a
340 * power-of-two size (though they don't have to be square)</note>
342 * Return value: A newly allocated #CoglPrimitive with a reference of
343 * 1. This can be freed using cogl_object_unref().
346 * Stability: Unstable
349 cogl_primitive_new_p3 (CoglContext *context,
350 CoglVerticesMode mode,
352 const CoglVertexP3 *data);
355 * cogl_primitive_new_p2c4:
356 * @context: A #CoglContext
357 * @mode: A #CoglVerticesMode defining how to draw the vertices
358 * @n_vertices: The number of vertices to read from @data and also
359 * the number of vertices to read when later drawing.
360 * @data: An array of #CoglVertexP2C4 vertices
362 * Provides a convenient way to describe a primitive, such as a single
363 * triangle strip or a triangle fan, that will internally allocate the
364 * necessary #CoglAttributeBuffer storage, describe the position
365 * and color attributes with #CoglAttribute<!-- -->s and upload
368 * For example to draw a convex polygon with a linear gradient you
371 * CoglVertexP2C4 triangle[] =
373 * { 0, 300, 0xff, 0x00, 0x00, 0xff },
374 * { 150, 0, 0x00, 0xff, 0x00, 0xff },
375 * { 300, 300, 0xff, 0x00, 0x00, 0xff }
377 * prim = cogl_primitive_new_p2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
379 * cogl_primitive_draw (prim);
382 * The value passed as @n_vertices is initially used to determine how
383 * much can be read from @data but it will also be used to update the
384 * #CoglPrimitive::n_vertices property as if
385 * cogl_primitive_set_n_vertices() were called. This property defines
386 * the number of vertices to read when drawing.
388 * <note>The primitive API doesn't support drawing with sliced
389 * textures (since switching between slices implies changing state and
390 * so that implies multiple primitives need to be submitted). You
391 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
392 * might be used while drawing with this API. If your hardware doesn't
393 * support non-power of two textures (For example you are using GLES
394 * 1.1) then you will need to make sure your assets are resized to a
395 * power-of-two size (though they don't have to be square)</note>
397 * Return value: A newly allocated #CoglPrimitive with a reference of
398 * 1. This can be freed using cogl_object_unref().
401 * Stability: Unstable
404 cogl_primitive_new_p2c4 (CoglContext *context,
405 CoglVerticesMode mode,
407 const CoglVertexP2C4 *data);
410 * cogl_primitive_new_p3c4:
411 * @context: A #CoglContext
412 * @mode: A #CoglVerticesMode defining how to draw the vertices
413 * @n_vertices: The number of vertices to read from @data and also
414 * the number of vertices to read when later drawing.
415 * @data: An array of #CoglVertexP3C4 vertices
417 * Provides a convenient way to describe a primitive, such as a single
418 * triangle strip or a triangle fan, that will internally allocate the
419 * necessary #CoglAttributeBuffer storage, describe the position
420 * and color attributes with #CoglAttribute<!-- -->s and upload
423 * For example to draw a convex polygon with a linear gradient you
426 * CoglVertexP3C4 triangle[] =
428 * { 0, 300, 0, 0xff, 0x00, 0x00, 0xff },
429 * { 150, 0, 0, 0x00, 0xff, 0x00, 0xff },
430 * { 300, 300, 0, 0xff, 0x00, 0x00, 0xff }
432 * prim = cogl_primitive_new_p3c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
434 * cogl_primitive_draw (prim);
437 * The value passed as @n_vertices is initially used to determine how
438 * much can be read from @data but it will also be used to update the
439 * #CoglPrimitive::n_vertices property as if
440 * cogl_primitive_set_n_vertices() were called. This property defines
441 * the number of vertices to read when drawing.
443 * <note>The primitive API doesn't support drawing with sliced
444 * textures (since switching between slices implies changing state and
445 * so that implies multiple primitives need to be submitted). You
446 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
447 * might be used while drawing with this API. If your hardware doesn't
448 * support non-power of two textures (For example you are using GLES
449 * 1.1) then you will need to make sure your assets are resized to a
450 * power-of-two size (though they don't have to be square)</note>
452 * Return value: A newly allocated #CoglPrimitive with a reference of
453 * 1. This can be freed using cogl_object_unref().
456 * Stability: Unstable
459 cogl_primitive_new_p3c4 (CoglContext *context,
460 CoglVerticesMode mode,
462 const CoglVertexP3C4 *data);
465 * cogl_primitive_new_p2t2:
466 * @context: A #CoglContext
467 * @mode: A #CoglVerticesMode defining how to draw the vertices
468 * @n_vertices: The number of vertices to read from @data and also
469 * the number of vertices to read when later drawing.
470 * @data: An array of #CoglVertexP2T2 vertices
472 * Provides a convenient way to describe a primitive, such as a single
473 * triangle strip or a triangle fan, that will internally allocate the
474 * necessary #CoglAttributeBuffer storage, describe the position and
475 * texture coordinate attributes with #CoglAttribute<!-- -->s and
478 * For example to draw a convex polygon with texture mapping you can
481 * CoglVertexP2T2 triangle[] =
483 * { 0, 300, 0.0, 1.0},
484 * { 150, 0, 0.5, 0.0},
485 * { 300, 300, 1.0, 1.0}
487 * prim = cogl_primitive_new_p2t2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
489 * cogl_primitive_draw (prim);
492 * The value passed as @n_vertices is initially used to determine how
493 * much can be read from @data but it will also be used to update the
494 * #CoglPrimitive::n_vertices property as if
495 * cogl_primitive_set_n_vertices() were called. This property defines
496 * the number of vertices to read when drawing.
498 * <note>The primitive API doesn't support drawing with sliced
499 * textures (since switching between slices implies changing state and
500 * so that implies multiple primitives need to be submitted). You
501 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
502 * might be used while drawing with this API. If your hardware doesn't
503 * support non-power of two textures (For example you are using GLES
504 * 1.1) then you will need to make sure your assets are resized to a
505 * power-of-two size (though they don't have to be square)</note>
507 * Return value: A newly allocated #CoglPrimitive with a reference of
508 * 1. This can be freed using cogl_object_unref().
511 * Stability: Unstable
514 cogl_primitive_new_p2t2 (CoglContext *context,
515 CoglVerticesMode mode,
517 const CoglVertexP2T2 *data);
520 * cogl_primitive_new_p3t2:
521 * @context: A #CoglContext
522 * @mode: A #CoglVerticesMode defining how to draw the vertices
523 * @n_vertices: The number of vertices to read from @data and also
524 * the number of vertices to read when later drawing.
525 * @data: An array of #CoglVertexP3T2 vertices
527 * Provides a convenient way to describe a primitive, such as a single
528 * triangle strip or a triangle fan, that will internally allocate the
529 * necessary #CoglAttributeBuffer storage, describe the position and
530 * texture coordinate attributes with #CoglAttribute<!-- -->s and
533 * For example to draw a convex polygon with texture mapping you can
536 * CoglVertexP3T2 triangle[] =
538 * { 0, 300, 0, 0.0, 1.0},
539 * { 150, 0, 0, 0.5, 0.0},
540 * { 300, 300, 0, 1.0, 1.0}
542 * prim = cogl_primitive_new_p3t2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
544 * cogl_primitive_draw (prim);
547 * The value passed as @n_vertices is initially used to determine how
548 * much can be read from @data but it will also be used to update the
549 * #CoglPrimitive::n_vertices property as if
550 * cogl_primitive_set_n_vertices() were called. This property defines
551 * the number of vertices to read when drawing.
553 * <note>The primitive API doesn't support drawing with sliced
554 * textures (since switching between slices implies changing state and
555 * so that implies multiple primitives need to be submitted). You
556 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
557 * might be used while drawing with this API. If your hardware doesn't
558 * support non-power of two textures (For example you are using GLES
559 * 1.1) then you will need to make sure your assets are resized to a
560 * power-of-two size (though they don't have to be square)</note>
562 * Return value: A newly allocated #CoglPrimitive with a reference of
563 * 1. This can be freed using cogl_object_unref().
566 * Stability: Unstable
569 cogl_primitive_new_p3t2 (CoglContext *context,
570 CoglVerticesMode mode,
572 const CoglVertexP3T2 *data);
575 * cogl_primitive_new_p2t2c4:
576 * @context: A #CoglContext
577 * @mode: A #CoglVerticesMode defining how to draw the vertices
578 * @n_vertices: The number of vertices to read from @data and also
579 * the number of vertices to read when later drawing.
580 * @data: An array of #CoglVertexP2T2C4 vertices
582 * Provides a convenient way to describe a primitive, such as a single
583 * triangle strip or a triangle fan, that will internally allocate the
584 * necessary #CoglAttributeBuffer storage, describe the position, texture
585 * coordinate and color attributes with #CoglAttribute<!-- -->s and
588 * For example to draw a convex polygon with texture mapping and a
589 * linear gradient you can do:
591 * CoglVertexP2T2C4 triangle[] =
593 * { 0, 300, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff},
594 * { 150, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff},
595 * { 300, 300, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff}
597 * prim = cogl_primitive_new_p2t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
599 * cogl_primitive_draw (prim);
602 * The value passed as @n_vertices is initially used to determine how
603 * much can be read from @data but it will also be used to update the
604 * #CoglPrimitive::n_vertices property as if
605 * cogl_primitive_set_n_vertices() were called. This property defines
606 * the number of vertices to read when drawing.
608 * <note>The primitive API doesn't support drawing with sliced
609 * textures (since switching between slices implies changing state and
610 * so that implies multiple primitives need to be submitted). You
611 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
612 * might be used while drawing with this API. If your hardware doesn't
613 * support non-power of two textures (For example you are using GLES
614 * 1.1) then you will need to make sure your assets are resized to a
615 * power-of-two size (though they don't have to be square)</note>
617 * Return value: A newly allocated #CoglPrimitive with a reference of
618 * 1. This can be freed using cogl_object_unref().
621 * Stability: Unstable
624 cogl_primitive_new_p2t2c4 (CoglContext *context,
625 CoglVerticesMode mode,
627 const CoglVertexP2T2C4 *data);
630 * cogl_primitive_new_p3t2c4:
631 * @context: A #CoglContext
632 * @mode: A #CoglVerticesMode defining how to draw the vertices
633 * @n_vertices: The number of vertices to read from @data and also
634 * the number of vertices to read when later drawing.
635 * @data: An array of #CoglVertexP3T2C4 vertices
637 * Provides a convenient way to describe a primitive, such as a single
638 * triangle strip or a triangle fan, that will internally allocate the
639 * necessary #CoglAttributeBuffer storage, describe the position, texture
640 * coordinate and color attributes with #CoglAttribute<!-- -->s and
643 * For example to draw a convex polygon with texture mapping and a
644 * linear gradient you can do:
646 * CoglVertexP3T2C4 triangle[] =
648 * { 0, 300, 0, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff},
649 * { 150, 0, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff},
650 * { 300, 300, 0, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff}
652 * prim = cogl_primitive_new_p3t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
654 * cogl_primitive_draw (prim);
657 * The value passed as @n_vertices is initially used to determine how
658 * much can be read from @data but it will also be used to update the
659 * #CoglPrimitive::n_vertices property as if
660 * cogl_primitive_set_n_vertices() were called. This property defines
661 * the number of vertices to read when drawing.
663 * <note>The primitive API doesn't support drawing with sliced
664 * textures (since switching between slices implies changing state and
665 * so that implies multiple primitives need to be submitted). You
666 * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
667 * might be used while drawing with this API. If your hardware doesn't
668 * support non-power of two textures (For example you are using GLES
669 * 1.1) then you will need to make sure your assets are resized to a
670 * power-of-two size (though they don't have to be square)</note>
672 * Return value: A newly allocated #CoglPrimitive with a reference of
673 * 1. This can be freed using cogl_object_unref().
676 * Stability: Unstable
679 cogl_primitive_new_p3t2c4 (CoglContext *context,
680 CoglVerticesMode mode,
682 const CoglVertexP3T2C4 *data);
684 cogl_primitive_get_first_vertex (CoglPrimitive *primitive);
687 cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
690 #define cogl_primitive_get_n_vertices cogl_primitive_get_n_vertices_EXP
692 * cogl_primitive_get_n_vertices:
693 * @primitive: A #CoglPrimitive object
695 * Queries the number of vertices to read when drawing the given
696 * @primitive. Usually this value is implicitly set when associating
697 * vertex data or indices with a #CoglPrimitive.
699 * If cogl_primitive_set_indices() has been used to associate a
700 * sequence of #CoglIndices with the given @primitive then the
701 * number of vertices to read can also be phrased as the number
702 * of indices to read.
704 * <note>To be clear; it doesn't refer to the number of vertices - in
705 * terms of data - associated with the primitive it's just the number
706 * of vertices to read and draw.</note>
708 * Returns: The number of vertices to read when drawing.
711 * Stability: unstable
714 cogl_primitive_get_n_vertices (CoglPrimitive *primitive);
716 #define cogl_primitive_set_n_vertices cogl_primitive_set_n_vertices_EXP
718 * cogl_primitive_set_n_vertices:
719 * @primitive: A #CoglPrimitive object
720 * @n_vertices: The number of vertices to read when drawing.
722 * Specifies how many vertices should be read when drawing the given
725 * Usually this value is set implicitly when associating vertex data
726 * or indices with a #CoglPrimitive.
728 * <note>To be clear; it doesn't refer to the number of vertices - in
729 * terms of data - associated with the primitive it's just the number
730 * of vertices to read and draw.</note>
733 * Stability: unstable
736 cogl_primitive_set_n_vertices (CoglPrimitive *primitive,
740 cogl_primitive_get_mode (CoglPrimitive *primitive);
743 cogl_primitive_set_mode (CoglPrimitive *primitive,
744 CoglVerticesMode mode);
747 * cogl_primitive_set_attributes:
748 * @primitive: A #CoglPrimitive object
749 * @attributes: A %NULL terminated array of #CoglAttribute
752 * Replaces all the attributes of the given #CoglPrimitive object.
755 * Stability: Unstable
758 cogl_primitive_set_attributes (CoglPrimitive *primitive,
759 CoglAttribute **attributes,
762 #define cogl_primitive_set_indices cogl_primitive_set_indices_EXP
764 * cogl_primitive_set_indices:
765 * @primitive: A #CoglPrimitive
766 * @indices: A #CoglIndices array
767 * @n_indices: The number of indices to reference when drawing
769 * Associates a sequence of #CoglIndices with the given @primitive.
771 * #CoglIndices provide a way to virtualize your real vertex data by
772 * providing a sequence of indices that index into your real vertex
773 * data. The GPU will walk though the index values to indirectly
774 * lookup the data for each vertex instead of sequentially walking
775 * through the data directly. This lets you save memory by indexing
776 * shared data multiple times instead of duplicating the data.
778 * The value passed as @n_indices will simply update the
779 * #CoglPrimitive::n_vertices property as if
780 * cogl_primitive_set_n_vertices() were called. This property defines
781 * the number of vertices to draw or, put another way, how many
782 * indices should be read from @indices when drawing.
784 * <note>The #CoglPrimitive::first_vertex property also affects
785 * drawing with indices by defining the first entry of the indices to
786 * start drawing from.</note>
789 * Stability: unstable
792 cogl_primitive_set_indices (CoglPrimitive *primitive,
793 CoglIndices *indices,
797 * cogl_primitive_get_indices:
798 * @primitive: A #CoglPrimitive
800 * Return value: the indices that were set with
801 * cogl_primitive_set_indices() or %NULL if no indices were set.
804 * Stability: unstable
807 cogl_primitive_get_indices (CoglPrimitive *primitive);
810 * cogl_primitive_copy:
811 * @primitive: A primitive copy
813 * Makes a copy of an existing #CoglPrimitive. Note that the primitive
814 * is a shallow copy which means it will use the same attributes and
815 * attribute buffers as the original primitive.
817 * Return value: the new primitive
819 * Stability: unstable
822 cogl_primitive_copy (CoglPrimitive *primitive);
826 * @object: A #CoglObject
828 * Gets whether the given object references a #CoglPrimitive.
830 * Returns: %TRUE if the handle references a #CoglPrimitive,
834 * Stability: Unstable
837 cogl_is_primitive (void *object);
840 * CoglPrimitiveAttributeCallback:
841 * @primitive: The #CoglPrimitive whose attributes are being iterated
842 * @attribute: The #CoglAttribute
843 * @user_data: The private data passed to cogl_primitive_foreach_attribute()
845 * The callback prototype used with cogl_primitive_foreach_attribute()
846 * for iterating all the attributes of a #CoglPrimitive.
848 * The function should return TRUE to continue iteration or FALSE to
852 * Stability: Unstable
854 typedef gboolean (* CoglPrimitiveAttributeCallback) (CoglPrimitive *primitive,
855 CoglAttribute *attribute,
859 * cogl_primitive_foreach_attribute:
860 * @primitive: A #CoglPrimitive object
861 * @callback: A #CoglPrimitiveAttributeCallback to be called for each attribute
862 * @user_data: Private data that will be passed to the callback
864 * Iterates all the attributes of the given #CoglPrimitive.
867 * Stability: Unstable
870 cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
871 CoglPrimitiveAttributeCallback callback,
876 #endif /* __COGL_PRIMITIVE_H__ */