4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>Vertex Attributes</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
7
7
<link rel="home" href="index.html" title="Cogl 2.0 Reference Manual">
8
8
<link rel="up" href="cogl-buffer-layout-apis.html" title="Describing the layout of GPU Memory">
9
9
<link rel="prev" href="cogl-buffer-layout-apis.html" title="Describing the layout of GPU Memory">
10
10
<link rel="next" href="cogl-2.0-experimental-Indices.html" title="Indices">
11
<meta name="generator" content="GTK-Doc V1.17.1 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.18.1 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
14
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
38
38
</tr></table></div>
39
39
<div class="refsynopsisdiv">
40
40
<a name="cogl-2.0-experimental-Vertex-Attributes.synopsis"></a><h2>Synopsis</h2>
41
<pre class="synopsis"><span class="returnvalue">CoglAttribute</span> * <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-new" title="cogl_attribute_new ()">cogl_attribute_new</a> (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="type">CoglAttributeBuffer</span></a> *attribute_buffer</code></em>,
41
<pre class="synopsis"> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute">CoglAttribute</a>;
42
<a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="returnvalue">CoglAttribute</span></a> * <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-new" title="cogl_attribute_new ()">cogl_attribute_new</a> (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="type">CoglAttributeBuffer</span></a> *attribute_buffer</code></em>,
42
43
<em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
43
44
<em class="parameter"><code><span class="type">size_t</span> stride</code></em>,
44
45
<em class="parameter"><code><span class="type">size_t</span> offset</code></em>,
45
46
<em class="parameter"><code><span class="type">int</span> components</code></em>,
46
47
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglAttributeType" title="enum CoglAttributeType"><span class="type">CoglAttributeType</span></a> type</code></em>);
47
<span class="returnvalue">CoglBool</span> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-is-attribute" title="cogl_is_attribute ()">cogl_is_attribute</a> (<em class="parameter"><code><span class="type">void</span> *object</code></em>);
48
<span class="returnvalue">void</span> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-set-normalized" title="cogl_attribute_set_normalized ()">cogl_attribute_set_normalized</a> (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>,
49
<em class="parameter"><code><span class="type">CoglBool</span> normalized</code></em>);
50
<span class="returnvalue">CoglBool</span> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-get-normalized" title="cogl_attribute_get_normalized ()">cogl_attribute_get_normalized</a> (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>);
51
<a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="returnvalue">CoglAttributeBuffer</span></a> * <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-get-buffer" title="cogl_attribute_get_buffer ()">cogl_attribute_get_buffer</a> (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>);
52
<span class="returnvalue">void</span> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-set-buffer" title="cogl_attribute_set_buffer ()">cogl_attribute_set_buffer</a> (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>,
48
<a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="returnvalue">CoglBool</span></a> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-is-attribute" title="cogl_is_attribute ()">cogl_is_attribute</a> (<em class="parameter"><code><span class="type">void</span> *object</code></em>);
49
<span class="returnvalue">void</span> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-set-normalized" title="cogl_attribute_set_normalized ()">cogl_attribute_set_normalized</a> (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>,
50
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="type">CoglBool</span></a> normalized</code></em>);
51
<a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="returnvalue">CoglBool</span></a> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-get-normalized" title="cogl_attribute_get_normalized ()">cogl_attribute_get_normalized</a> (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>);
52
<a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="returnvalue">CoglAttributeBuffer</span></a> * <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-get-buffer" title="cogl_attribute_get_buffer ()">cogl_attribute_get_buffer</a> (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>);
53
<span class="returnvalue">void</span> <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#cogl-attribute-set-buffer" title="cogl_attribute_set_buffer ()">cogl_attribute_set_buffer</a> (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>,
53
54
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="type">CoglAttributeBuffer</span></a> *attribute_buffer</code></em>);
62
63
<div class="refsect1">
63
64
<a name="cogl-2.0-experimental-Vertex-Attributes.details"></a><h2>Details</h2>
64
65
<div class="refsect2">
66
<a name="CoglAttribute"></a><h3>CoglAttribute</h3>
67
<pre class="programlisting">typedef struct _CoglAttribute CoglAttribute;</pre>
70
<div class="refsect2">
65
71
<a name="cogl-attribute-new"></a><h3>cogl_attribute_new ()</h3>
66
<pre class="programlisting"><span class="returnvalue">CoglAttribute</span> * cogl_attribute_new (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="type">CoglAttributeBuffer</span></a> *attribute_buffer</code></em>,
72
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="returnvalue">CoglAttribute</span></a> * cogl_attribute_new (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="type">CoglAttributeBuffer</span></a> *attribute_buffer</code></em>,
67
73
<em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
68
74
<em class="parameter"><code><span class="type">size_t</span> stride</code></em>,
69
75
<em class="parameter"><code><span class="type">size_t</span> offset</code></em>,
78
84
shader and there are some special names you should use if they are
81
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
87
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
82
88
<li class="listitem">"cogl_position_in" (used for vertex positions)</li>
83
89
<li class="listitem">"cogl_color_in" (used for vertex colors)</li>
84
90
<li class="listitem">"cogl_tex_coord0_in", "cogl_tex_coord1", ...
104
<td class="listing_code"><pre class="programlisting"><span class="type">typedef</span> <span class="type">struct</span>
106
<span class="type">float</span> x, y, z; <span class="comment">/*</span><span class="comment"> position attribute </span><span class="comment">*/</span>
107
<span class="type">float</span> s, t; <span class="comment">/*</span><span class="comment"> texture coordinate attribute </span><span class="comment">*/</span>
108
} MyVertex;</pre></td>
110
<td class="listing_code"><pre class="programlisting"><span class="keyword">typedef</span><span class="normal"> </span><span class="keyword">struct</span>
111
<span class="cbracket">{</span>
112
<span class="normal"> </span><span class="type">float</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">,</span><span class="normal"> z</span><span class="symbol">;</span><span class="normal"> </span><span class="comment">/* position attribute */</span>
113
<span class="normal"> </span><span class="type">float</span><span class="normal"> s</span><span class="symbol">,</span><span class="normal"> t</span><span class="symbol">;</span><span class="normal"> </span><span class="comment">/* texture coordinate attribute */</span>
114
<span class="cbracket">}</span><span class="normal"> MyVertex</span><span class="symbol">;</span></pre></td>
164
170
mapped into the GPU which can be a bottlneck when dealing with
165
171
a large number of vertices.
167
<div class="variablelist"><table border="0">
173
<div class="variablelist"><table border="0" class="variablelist">
168
175
<col align="left" valign="top">
171
180
<td><p><span class="term"><em class="parameter"><code>attribute_buffer</code></em> :</span></p></td>
212
221
<div class="refsect2">
213
222
<a name="cogl-is-attribute"></a><h3>cogl_is_attribute ()</h3>
214
<pre class="programlisting"><span class="returnvalue">CoglBool</span> cogl_is_attribute (<em class="parameter"><code><span class="type">void</span> *object</code></em>);</pre>
223
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="returnvalue">CoglBool</span></a> cogl_is_attribute (<em class="parameter"><code><span class="type">void</span> *object</code></em>);</pre>
216
Gets whether the given object references a <span class="type">CoglAttribute</span>.
225
Gets whether the given object references a <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a>.
218
<div class="variablelist"><table border="0">
227
<div class="variablelist"><table border="0" class="variablelist">
219
229
<col align="left" valign="top">
222
234
<td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
227
239
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
229
<code class="literal">TRUE</code> if the <em class="parameter"><code>object</code></em> references a <span class="type">CoglAttribute</span>,
230
<code class="literal">FALSE</code> otherwise</td>
241
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <em class="parameter"><code>object</code></em> references a <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a>,
242
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
236
248
<div class="refsect2">
237
249
<a name="cogl-attribute-set-normalized"></a><h3>cogl_attribute_set_normalized ()</h3>
238
<pre class="programlisting"><span class="returnvalue">void</span> cogl_attribute_set_normalized (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>,
239
<em class="parameter"><code><span class="type">CoglBool</span> normalized</code></em>);</pre>
250
<pre class="programlisting"><span class="returnvalue">void</span> cogl_attribute_set_normalized (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>,
251
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="type">CoglBool</span></a> normalized</code></em>);</pre>
241
253
Sets whether fixed point attribute types are mapped to the range
242
254
0→1. For example when this property is TRUE and a
249
261
cogl_normal_in it will default to TRUE and for all other names it
250
262
will default to FALSE.
252
<div class="variablelist"><table border="0">
264
<div class="variablelist"><table border="0" class="variablelist">
253
266
<col align="left" valign="top">
256
271
<td><p><span class="term"><em class="parameter"><code>attribute</code></em> :</span></p></td>
257
<td>A <span class="type">CoglAttribute</span>
272
<td>A <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a>
270
285
<div class="refsect2">
271
286
<a name="cogl-attribute-get-normalized"></a><h3>cogl_attribute_get_normalized ()</h3>
272
<pre class="programlisting"><span class="returnvalue">CoglBool</span> cogl_attribute_get_normalized (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>);</pre>
273
<div class="variablelist"><table border="0">
287
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="returnvalue">CoglBool</span></a> cogl_attribute_get_normalized (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>);</pre>
288
<div class="variablelist"><table border="0" class="variablelist">
274
290
<col align="left" valign="top">
277
295
<td><p><span class="term"><em class="parameter"><code>attribute</code></em> :</span></p></td>
278
<td>A <span class="type">CoglAttribute</span>
296
<td>A <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a>
292
310
<div class="refsect2">
293
311
<a name="cogl-attribute-get-buffer"></a><h3>cogl_attribute_get_buffer ()</h3>
294
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="returnvalue">CoglAttributeBuffer</span></a> * cogl_attribute_get_buffer (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>);</pre>
295
<div class="variablelist"><table border="0">
312
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="returnvalue">CoglAttributeBuffer</span></a> * cogl_attribute_get_buffer (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>);</pre>
313
<div class="variablelist"><table border="0" class="variablelist">
296
315
<col align="left" valign="top">
299
320
<td><p><span class="term"><em class="parameter"><code>attribute</code></em> :</span></p></td>
300
<td>A <span class="type">CoglAttribute</span>
321
<td>A <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a>
314
335
<div class="refsect2">
315
336
<a name="cogl-attribute-set-buffer"></a><h3>cogl_attribute_set_buffer ()</h3>
316
<pre class="programlisting"><span class="returnvalue">void</span> cogl_attribute_set_buffer (<em class="parameter"><code><span class="type">CoglAttribute</span> *attribute</code></em>,
337
<pre class="programlisting"><span class="returnvalue">void</span> cogl_attribute_set_buffer (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a> *attribute</code></em>,
317
338
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="type">CoglAttributeBuffer</span></a> *attribute_buffer</code></em>);</pre>
319
340
Sets a new <a class="link" href="cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html#CoglAttributeBuffer" title="CoglAttributeBuffer"><span class="type">CoglAttributeBuffer</span></a> for the attribute.
321
<div class="variablelist"><table border="0">
342
<div class="variablelist"><table border="0" class="variablelist">
322
344
<col align="left" valign="top">
325
349
<td><p><span class="term"><em class="parameter"><code>attribute</code></em> :</span></p></td>
326
<td>A <span class="type">CoglAttribute</span>
350
<td>A <a class="link" href="cogl-2.0-experimental-Vertex-Attributes.html#CoglAttribute" title="CoglAttribute"><span class="type">CoglAttribute</span></a>