/usr/share/gtk-doc/html/cogl-2.0-experimental/cogl-2.0-experimental-Indices.html is in libcogl-doc 1.18.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cogl 2.0 Reference Manual: Indices</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Cogl 2.0 Reference Manual">
<link rel="up" href="cogl-buffer-layout-apis.html" title="Describing the layout of GPU Memory">
<link rel="prev" href="cogl-2.0-experimental-Vertex-Attributes.html" title="Vertex Attributes">
<link rel="next" href="cogl-primitive-apis.html" title="Geometry">
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#cogl-2.0-experimental-Indices.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="cogl-buffer-layout-apis.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="cogl-2.0-experimental-Vertex-Attributes.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="cogl-primitive-apis.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="cogl-2.0-experimental-Indices"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="cogl-2.0-experimental-Indices.top_of_page"></a>Indices</span></h2>
<p>Indices — Describe vertex indices stored in a <a class="link" href="cogl-2.0-experimental-CoglIndexBuffer---Buffers-of-vertex-indices.html#CoglIndexBuffer" title="CoglIndexBuffer"><span class="type">CoglIndexBuffer</span></a>.</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="cogl-2.0-experimental-Indices.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="returnvalue">CoglBool</span></a>
</td>
<td class="function_name">
<a class="link" href="cogl-2.0-experimental-Indices.html#cogl-is-indices" title="cogl_is_indices ()">cogl_is_indices</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndices" title="CoglIndices"><span class="returnvalue">CoglIndices</span></a> *
</td>
<td class="function_name">
<a class="link" href="cogl-2.0-experimental-Indices.html#cogl-indices-new" title="cogl_indices_new ()">cogl_indices_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndices" title="CoglIndices"><span class="returnvalue">CoglIndices</span></a> *
</td>
<td class="function_name">
<a class="link" href="cogl-2.0-experimental-Indices.html#cogl-get-rectangle-indices" title="cogl_get_rectangle_indices ()">cogl_get_rectangle_indices</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="cogl-2.0-experimental-Indices.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndices" title="CoglIndices">CoglIndices</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndicesType" title="enum CoglIndicesType">CoglIndicesType</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="cogl-2.0-experimental-Indices.description"></a><h2>Description</h2>
<p>Indices allow you to avoid duplicating vertices in your vertex data
by virtualizing your data and instead providing a sequence of index
values that tell the GPU which data should be used for each vertex.</p>
<p>If the GPU is given a sequence of indices it doesn't simply walk
through each vertex of your data in order it will instead walk
through the indices which can provide random access to the
underlying data.</p>
<p>Since it's very common to have duplicate vertices when describing a
shape as a list of triangles it can often be a significant space
saving to describe geometry using indices. Reducing the size of
your models can make it cheaper to map them into the GPU by
reducing the demand on memory bandwidth and may help to make better
use of your GPUs internal vertex caching.</p>
<p>For example, to describe a quadrilateral as 2 triangles for the GPU
you could either provide data with 6 vertices or instead with
indices you can provide vertex data for just 4 vertices and an
index buffer that specfies the 6 vertices by indexing the shared
vertices multiple times.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8</pre></td>
<td class="listing_code"><pre class="programlisting">CoglVertex2f quad_vertices<span class="gtkdoc opt">[] = {</span>
<span class="gtkdoc opt">{</span>x0<span class="gtkdoc opt">,</span> y0<span class="gtkdoc opt">},</span> <span class="gtkdoc slc">//0 = top left</span>
<span class="gtkdoc opt">{</span>x1<span class="gtkdoc opt">,</span> y1<span class="gtkdoc opt">},</span> <span class="gtkdoc slc">//1 = bottom left</span>
<span class="gtkdoc opt">{</span>x2<span class="gtkdoc opt">,</span> y2<span class="gtkdoc opt">},</span> <span class="gtkdoc slc">//2 = bottom right</span>
<span class="gtkdoc opt">{</span>x3<span class="gtkdoc opt">,</span> y3<span class="gtkdoc opt">},</span> <span class="gtkdoc slc">//3 = top right</span>
<span class="gtkdoc opt">};</span>
<span class="gtkdoc slc">//tell the gpu how to interpret the quad as 2 triangles...</span>
<span class="gtkdoc kwb">unsigned char</span> indices<span class="gtkdoc opt">[] = {</span><span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">};</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>Even in the above illustration we see a saving of 10bytes for one
quad compared to having data for 6 vertices and no indices but if
you need to draw 100s or 1000s of quads then its really quite
significant.</p>
<p>Something else to consider is that often indices can be defined
once and remain static while the vertex data may change for
animations perhaps. That means you may be able to ignore the
negligable cost of mapping your indices into the GPU if they don't
ever change.</p>
<p>The above illustration is actually a good example of static indices
because it's really common that developers have quad mesh data that
they need to display and we know exactly what that indices array
needs to look like depending on the number of quads that need to be
drawn. It doesn't matter how the quads might be animated and
changed the indices will remain the same. Cogl even has a utility
(<a class="link" href="cogl-2.0-experimental-Indices.html#cogl-get-rectangle-indices" title="cogl_get_rectangle_indices ()"><code class="function">cogl_get_rectangle_indices()</code></a>) to get access to re-useable indices
for drawing quads as above.</p>
</div>
<div class="refsect1">
<a name="cogl-2.0-experimental-Indices.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="cogl-is-indices"></a><h3>cogl_is_indices ()</h3>
<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_indices (<em class="parameter"><code><span class="type">void</span> *object</code></em>);</pre>
<p>Gets whether the given object references a <a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndices" title="CoglIndices"><span class="type">CoglIndices</span></a>.</p>
<div class="refsect3">
<a name="id-1.2.7.3.6.2.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>object</p></td>
<td class="parameter_description"><p>A <a class="link" href="cogl-2.0-experimental-The-Object-Interface.html#CoglObject" title="CoglObject"><span class="type">CoglObject</span></a> pointer</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.7.3.6.2.6"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the object references a <a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndices" title="CoglIndices"><span class="type">CoglIndices</span></a>
and <code class="literal">FALSE</code> otherwise.</p>
<p></p>
</div>
<p class="since">Since 1.10</p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-indices-new"></a><h3>cogl_indices_new ()</h3>
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndices" title="CoglIndices"><span class="returnvalue">CoglIndices</span></a> *
cogl_indices_new (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#CoglContext" title="CoglContext"><span class="type">CoglContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndicesType" title="enum CoglIndicesType"><span class="type">CoglIndicesType</span></a> type</code></em>,
<em class="parameter"><code>const <span class="type">void</span> *indices_data</code></em>,
<em class="parameter"><code><span class="type">int</span> n_indices</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="cogl-get-rectangle-indices"></a><h3>cogl_get_rectangle_indices ()</h3>
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Indices.html#CoglIndices" title="CoglIndices"><span class="returnvalue">CoglIndices</span></a> *
cogl_get_rectangle_indices (<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#CoglContext" title="CoglContext"><span class="type">CoglContext</span></a> *context</code></em>,
<em class="parameter"><code><span class="type">int</span> n_rectangles</code></em>);</pre>
</div>
</div>
<div class="refsect1">
<a name="cogl-2.0-experimental-Indices.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="CoglIndices"></a><h3>CoglIndices</h3>
<pre class="programlisting">typedef struct _CoglIndices CoglIndices;</pre>
</div>
<hr>
<div class="refsect2">
<a name="CoglIndicesType"></a><h3>enum CoglIndicesType</h3>
<p>You should aim to use the smallest data type that gives you enough
range, since it reduces the size of your index array and can help
reduce the demand on memory bandwidth.</p>
<p>Note that <a class="link" href="cogl-2.0-experimental-Indices.html#COGL-INDICES-TYPE-UNSIGNED-INT:CAPS"><code class="literal">COGL_INDICES_TYPE_UNSIGNED_INT</code></a> is only supported if the
<a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#COGL-FEATURE-ID-UNSIGNED-INT-INDICES:CAPS"><code class="literal">COGL_FEATURE_ID_UNSIGNED_INT_INDICES</code></a> feature is available. This
should always be available on OpenGL but on OpenGL ES it will only
be available if the GL_OES_element_index_uint extension is
advertized.</p>
<div class="refsect3">
<a name="id-1.2.7.3.7.3.5"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="COGL-INDICES-TYPE-UNSIGNED-BYTE:CAPS"></a>COGL_INDICES_TYPE_UNSIGNED_BYTE</p></td>
<td class="enum_member_description">
<p>Your indices are unsigned bytes</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="COGL-INDICES-TYPE-UNSIGNED-SHORT:CAPS"></a>COGL_INDICES_TYPE_UNSIGNED_SHORT</p></td>
<td class="enum_member_description">
<p>Your indices are unsigned shorts</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="COGL-INDICES-TYPE-UNSIGNED-INT:CAPS"></a>COGL_INDICES_TYPE_UNSIGNED_INT</p></td>
<td class="enum_member_description">
<p>Your indices are unsigned ints</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.21</div>
</body>
</html>
|