/usr/share/qt5/doc/qtquick/qsggeometry.html is in qtdeclarative5-doc-html 5.5.1-2ubuntu6.
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 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsggeometry.cpp -->
<title>QSGGeometry Class | Qt Quick 5.5</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.5</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li><a href="qtquick-module.html">C++ Classes</a></li>
<li>QSGGeometry</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QSGGeometry Class</h1>
<!-- $$$QSGGeometry-brief -->
<p>The <a href="qsggeometry.html">QSGGeometry</a> class provides low-level storage for graphics primitives in the <a href="qtquick-visualcanvas-scenegraph.html">Qt Quick Scene Graph</a>. <a href="#details">More...</a></p>
<!-- @@@QSGGeometry -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QSGGeometry></span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += quick</td></tr></table></div><ul>
<li><a href="qsggeometry-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attribute.html">Attribute</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-attributeset.html">AttributeSet</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-coloredpoint2d.html">ColoredPoint2D</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-point2d.html">Point2D</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry-texturedpoint2d.html">TexturedPoint2D</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#DataPattern-enum">DataPattern</a></b> { AlwaysUploadPattern, DynamicPattern, StaticPattern, StreamPattern }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></b>(const QSGGeometry::AttributeSet &<i> attributes</i>, int<i> vertexCount</i>, int<i> indexCount</i> = 0, int<i> indexType</i> = GL_UNSIGNED_SHORT)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#dtor.QSGGeometry">~QSGGeometry</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#allocate">allocate</a></b>(int<i> vertexCount</i>, int<i> indexCount</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#attributeCount">attributeCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const Attribute * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#attributes">attributes</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> GLenum </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#drawingMode">drawingMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexCount">indexCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexData">indexData</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const void * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexData-2">indexData</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexDataAsUInt">indexDataAsUInt</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const uint * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexDataAsUInt-2">indexDataAsUInt</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint16 * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexDataAsUShort">indexDataAsUShort</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const quint16 * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexDataAsUShort-2">indexDataAsUShort</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> DataPattern </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexDataPattern">indexDataPattern</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#indexType">indexType</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> float </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#lineWidth">lineWidth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#markIndexDataDirty">markIndexDataDirty</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#markVertexDataDirty">markVertexDataDirty</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#setDrawingMode">setDrawingMode</a></b>(GLenum<i> mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#setIndexDataPattern">setIndexDataPattern</a></b>(DataPattern<i> p</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#setLineWidth">setLineWidth</a></b>(float<i> width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#setVertexDataPattern">setVertexDataPattern</a></b>(DataPattern<i> p</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#sizeOfIndex">sizeOfIndex</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#sizeOfVertex">sizeOfVertex</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexCount">vertexCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexData">vertexData</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const void * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexData-2">vertexData</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ColoredPoint2D * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexDataAsColoredPoint2D">vertexDataAsColoredPoint2D</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const ColoredPoint2D * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexDataAsColoredPoint2D-2">vertexDataAsColoredPoint2D</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Point2D * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexDataAsPoint2D">vertexDataAsPoint2D</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const Point2D * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexDataAsPoint2D-2">vertexDataAsPoint2D</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> TexturedPoint2D * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexDataAsTexturedPoint2D">vertexDataAsTexturedPoint2D</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const TexturedPoint2D * </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexDataAsTexturedPoint2D-2">vertexDataAsTexturedPoint2D</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> DataPattern </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#vertexDataPattern">vertexDataPattern</a></b>() const</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> const AttributeSet & </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#defaultAttributes_ColoredPoint2D">defaultAttributes_ColoredPoint2D</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const AttributeSet & </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#defaultAttributes_Point2D">defaultAttributes_Point2D</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const AttributeSet & </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#defaultAttributes_TexturedPoint2D">defaultAttributes_TexturedPoint2D</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#updateRectGeometry">updateRectGeometry</a></b>(QSGGeometry *<i> g</i>, const QRectF &<i> rect</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsggeometry.html#updateTexturedRectGeometry">updateTexturedRectGeometry</a></b>(QSGGeometry *<i> g</i>, const QRectF &<i> rect</i>, const QRectF &<i> textureRect</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QSGGeometry-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qsggeometry.html">QSGGeometry</a> class provides low-level storage for graphics primitives in the <a href="qtquick-visualcanvas-scenegraph.html">Qt Quick Scene Graph</a>.</p>
<p>The <a href="qsggeometry.html">QSGGeometry</a> class stores the geometry of the primitives rendered with the scene graph. It contains vertex data and optionally index data. The mode used to draw the geometry is specified with <a href="qsggeometry.html#setDrawingMode">setDrawingMode</a>(), which maps directly to the OpenGL drawing mode, such as <code>GL_TRIANGLE_STRIP</code>, <code>GL_TRIANGLES</code>, or <code>GL_POINTS</code>.</p>
<p>Vertices can be as simple as points defined by x and y values or can be more complex where each vertex contains a normal, texture coordinates and a 3D position. The <a href="qsggeometry-attributeset.html">QSGGeometry::AttributeSet</a> is used to describe how the vertex data is built up. The attribute set can only be specified on construction. The <a href="qsggeometry.html">QSGGeometry</a> class provides a few convenience attributes and attribute sets by default. The <a href="qsggeometry.html#defaultAttributes_Point2D">defaultAttributes_Point2D</a>() function returns an attribute set to be used in normal solid color rectangles, while the <a href="qsggeometry.html#defaultAttributes_TexturedPoint2D">defaultAttributes_TexturedPoint2D</a> function returns attributes to be used for textured 2D geometry. The vertex data is internally stored as a <code>void *</code> and is accessible with the <a href="qsggeometry.html#vertexData">vertexData</a>() function. Convenience accessors for the common attribute sets are available with <a href="qsggeometry.html#vertexDataAsPoint2D">vertexDataAsPoint2D</a>() and <a href="qsggeometry.html#vertexDataAsTexturedPoint2D">vertexDataAsTexturedPoint2D</a>(). Vertex data is allocated by passing a vertex count to the constructor or by calling <a href="qsggeometry.html#allocate">allocate</a>() later.</p>
<p>The <a href="qsggeometry.html">QSGGeometry</a> can optionally contain indices of either unsigned 32-bit, unsigned 16-bit, or unsigned 8-bit integers. The index type must be specified during construction and cannot be changed.</p>
<p>Below is a snippet illustrating how a geometry composed of position and color vertices can be built.</p>
<pre class="cpp"><span class="keyword">struct</span> MyPoint2D {
<span class="type">float</span> x;
<span class="type">float</span> y;
<span class="type">float</span> r;
<span class="type">float</span> g;
<span class="type">float</span> b;
<span class="type">float</span> a;
<span class="type">void</span> set(<span class="type">float</span> x_<span class="operator">,</span> <span class="type">float</span> y_<span class="operator">,</span> <span class="type">float</span> r_<span class="operator">,</span> <span class="type">float</span> g_<span class="operator">,</span> <span class="type">float</span> b_<span class="operator">,</span> <span class="type">float</span> a_) {
x <span class="operator">=</span> x_;
y <span class="operator">=</span> y_;
r <span class="operator">=</span> r_;
g <span class="operator">=</span> g_;
b <span class="operator">=</span> b_;
a <span class="operator">=</span> a_;
}
};
<span class="type"><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></span><span class="operator">::</span>Attribute MyPoint2D_Attributes<span class="operator">[</span><span class="operator">]</span> <span class="operator">=</span> {
<span class="type"><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></span><span class="operator">::</span>Attribute<span class="operator">::</span>create(<span class="number">0</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> GL_FLOAT<span class="operator">,</span> <span class="keyword">true</span>)<span class="operator">,</span>
<span class="type"><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></span><span class="operator">::</span>Attribute<span class="operator">::</span>create(<span class="number">1</span><span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> GL_FLOAT<span class="operator">,</span> <span class="keyword">false</span>)
};
<span class="type"><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></span><span class="operator">::</span>AttributeSet MyPoint2D_AttributeSet <span class="operator">=</span> {
<span class="number">2</span><span class="operator">,</span>
<span class="keyword">sizeof</span>(MyPoint2D)<span class="operator">,</span>
MyPoint2D_Attributes
};
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
geometry <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></span>(MyPoint2D_AttributeSet<span class="operator">,</span> <span class="number">2</span>);
geometry<span class="operator">-</span><span class="operator">></span><a href="qsggeometry.html#setDrawingMode">setDrawingMode</a>(GL_LINES);
MyPoint2D <span class="operator">*</span>vertices <span class="operator">=</span> <span class="keyword">static_cast</span><span class="operator"><</span>MyPoint2D <span class="operator">*</span><span class="operator">></span>(geometry<span class="operator">-</span><span class="operator">></span>vertexData());
vertices<span class="operator">[</span><span class="number">0</span><span class="operator">]</span><span class="operator">.</span>set(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
vertices<span class="operator">[</span><span class="number">1</span><span class="operator">]</span><span class="operator">.</span>set(width()<span class="operator">,</span> height()<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">1</span>);</pre>
<p>The <a href="qsggeometry.html">QSGGeometry</a> is a software buffer and client-side in terms of OpenGL rendering, as the buffers used in 2D graphics typically consist of many small buffers that change every frame and do not benefit from being uploaded to graphics memory. However, the <a href="qsggeometry.html">QSGGeometry</a> supports hinting to the renderer that a buffer should be uploaded using the <a href="qsggeometry.html#setVertexDataPattern">setVertexDataPattern</a>() and <a href="qsggeometry.html#setIndexDataPattern">setIndexDataPattern</a>() functions. Whether this hint is respected or not is implementation specific.</p>
<p><b>Note: </b>All classes with QSG prefix should be used solely on the scene graph's rendering thread. See <a href="qtquick-visualcanvas-scenegraph.html#scene-graph-and-rendering">Scene Graph and Rendering</a> for more information.</p></div>
<p><b>See also </b><a href="qsggeometrynode.html">QSGGeometryNode</a> and <a href="qtquick-scenegraph-customgeometry-example.html">Scene Graph - Custom Geometry</a>.</p>
<!-- @@@QSGGeometry -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$DataPattern$$$AlwaysUploadPattern$$$StreamPattern$$$DynamicPattern$$$StaticPattern -->
<h3 class="fn" id="DataPattern-enum"><a name="DataPattern-enum"></a>enum QSGGeometry::<span class="name">DataPattern</span></h3>
<p>The DataPattern enum is used to specify the use pattern for the vertex and index data in a geometry object.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSGGeometry::AlwaysUploadPattern</code></td><td class="topAlign"><code>0</code></td><td class="topAlign">The data is always uploaded. This means that the user does not need to explicitly mark index and vertex data as dirty after changing it. This is the default.</td></tr>
<tr><td class="topAlign"><code>QSGGeometry::DynamicPattern</code></td><td class="topAlign"><code>2</code></td><td class="topAlign">The data is modified repeatedly and drawn many times. This is a hint that may provide better performance. When set the user must make sure to mark the data as dirty after changing it.</td></tr>
<tr><td class="topAlign"><code>QSGGeometry::StaticPattern</code></td><td class="topAlign"><code>3</code></td><td class="topAlign">The data is modified once and drawn many times. This is a hint that may provide better performance. When set the user must make sure to mark the data as dirty after changing it.</td></tr>
<tr><td class="topAlign"><code>QSGGeometry::StreamPattern</code></td><td class="topAlign"><code>1</code></td><td class="topAlign">The data is modified for almost every time it is drawn. This is a hint that may provide better performance. When set, the user must make sure to mark the data as dirty after changing it.</td></tr>
</table></div>
<!-- @@@DataPattern -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSGGeometry[overload1]$$$QSGGeometryconstQSGGeometry::AttributeSet&intintint -->
<h3 class="fn" id="QSGGeometry"><a name="QSGGeometry"></a>QSGGeometry::<span class="name">QSGGeometry</span>(const <span class="type"><a href="qsggeometry-attributeset.html">QSGGeometry::AttributeSet</a></span> &<i> attributes</i>, <span class="type">int</span><i> vertexCount</i>, <span class="type">int</span><i> indexCount</i> = 0, <span class="type">int</span><i> indexType</i> = GL_UNSIGNED_SHORT)</h3>
<p>Constructs a geometry object based on <i>attributes</i>.</p>
<p>The object allocate space for <i>vertexCount</i> vertices based on the accumulated size in <i>attributes</i> and for <i>indexCount</i>.</p>
<p>The <i>indexType</i> maps to the OpenGL index type and can be <code>GL_UNSIGNED_SHORT</code> and <code>GL_UNSIGNED_BYTE</code>. On OpenGL implementations that support it, such as desktop OpenGL, <code>GL_UNSIGNED_INT</code> can also be used.</p>
<p>Geometry objects are constructed with <code>GL_TRIANGLE_STRIP</code> as default drawing mode.</p>
<p>The attribute structure is assumed to be POD and the geometry object assumes this will not go away. There is no memory management involved.</p>
<!-- @@@QSGGeometry -->
<!-- $$$~QSGGeometry[overload1]$$$~QSGGeometry -->
<h3 class="fn" id="dtor.QSGGeometry"><a name="dtor.QSGGeometry"></a><code>[virtual] </code>QSGGeometry::<span class="name">~QSGGeometry</span>()</h3>
<p>Destroys the geometry object and the vertex and index data it has allocated.</p>
<!-- @@@~QSGGeometry -->
<!-- $$$allocate[overload1]$$$allocateintint -->
<h3 class="fn" id="allocate"><a name="allocate"></a><span class="type">void</span> QSGGeometry::<span class="name">allocate</span>(<span class="type">int</span><i> vertexCount</i>, <span class="type">int</span><i> indexCount</i> = 0)</h3>
<p>Resizes the vertex and index data of this geometry object to fit <i>vertexCount</i> vertices and <i>indexCount</i> indices.</p>
<p>Vertex and index data will be invalidated after this call and the caller must mark the associated geometry node as dirty, by calling node->markDirty(<a href="qsgnode.html#DirtyStateBit-enum">QSGNode::DirtyGeometry</a>) to ensure that the renderer has a chance to update internal buffers.</p>
<!-- @@@allocate -->
<!-- $$$attributeCount[overload1]$$$attributeCount -->
<h3 class="fn" id="attributeCount"><a name="attributeCount"></a><span class="type">int</span> QSGGeometry::<span class="name">attributeCount</span>() const</h3>
<p>Returns the number of attributes in the attrbute set used by this geometry.</p>
<!-- @@@attributeCount -->
<!-- $$$attributes[overload1]$$$attributes -->
<h3 class="fn" id="attributes"><a name="attributes"></a>const <span class="type"><a href="qsggeometry-attribute.html">Attribute</a></span> * QSGGeometry::<span class="name">attributes</span>() const</h3>
<p>Returns an array with the attributes of this geometry. The size of the array is given with <a href="qsggeometry.html#attributeCount">attributeCount</a>().</p>
<!-- @@@attributes -->
<!-- $$$defaultAttributes_ColoredPoint2D[overload1]$$$defaultAttributes_ColoredPoint2D -->
<h3 class="fn" id="defaultAttributes_ColoredPoint2D"><a name="defaultAttributes_ColoredPoint2D"></a><code>[static] </code>const <span class="type"><a href="qsggeometry-attributeset.html">AttributeSet</a></span> & QSGGeometry::<span class="name">defaultAttributes_ColoredPoint2D</span>()</h3>
<p>Convenience function which returns attributes to be used for per vertex colored 2D drawing.</p>
<!-- @@@defaultAttributes_ColoredPoint2D -->
<!-- $$$defaultAttributes_Point2D[overload1]$$$defaultAttributes_Point2D -->
<h3 class="fn" id="defaultAttributes_Point2D"><a name="defaultAttributes_Point2D"></a><code>[static] </code>const <span class="type"><a href="qsggeometry-attributeset.html">AttributeSet</a></span> & QSGGeometry::<span class="name">defaultAttributes_Point2D</span>()</h3>
<p>Convenience function which returns attributes to be used for 2D solid color drawing.</p>
<!-- @@@defaultAttributes_Point2D -->
<!-- $$$defaultAttributes_TexturedPoint2D[overload1]$$$defaultAttributes_TexturedPoint2D -->
<h3 class="fn" id="defaultAttributes_TexturedPoint2D"><a name="defaultAttributes_TexturedPoint2D"></a><code>[static] </code>const <span class="type"><a href="qsggeometry-attributeset.html">AttributeSet</a></span> & QSGGeometry::<span class="name">defaultAttributes_TexturedPoint2D</span>()</h3>
<p>Convenience function which returns attributes to be used for textured 2D drawing.</p>
<!-- @@@defaultAttributes_TexturedPoint2D -->
<!-- $$$drawingMode[overload1]$$$drawingMode -->
<h3 class="fn" id="drawingMode"><a name="drawingMode"></a><span class="type">GLenum</span> QSGGeometry::<span class="name">drawingMode</span>() const</h3>
<p>Returns the drawing mode of this geometry.</p>
<p>The default value is <code>GL_TRIANGLE_STRIP</code>.</p>
<p><b>See also </b><a href="qsggeometry.html#setDrawingMode">setDrawingMode</a>().</p>
<!-- @@@drawingMode -->
<!-- $$$indexCount[overload1]$$$indexCount -->
<h3 class="fn" id="indexCount"><a name="indexCount"></a><span class="type">int</span> QSGGeometry::<span class="name">indexCount</span>() const</h3>
<p>Returns the number of indices in this geometry object.</p>
<!-- @@@indexCount -->
<!-- $$$indexData[overload1]$$$indexData -->
<h3 class="fn" id="indexData"><a name="indexData"></a><span class="type">void</span> * QSGGeometry::<span class="name">indexData</span>()</h3>
<p>Returns a pointer to the raw index data of this geometry object.</p>
<p><b>See also </b><a href="qsggeometry.html#indexDataAsUShort">indexDataAsUShort</a>() and <a href="qsggeometry.html#indexDataAsUInt">indexDataAsUInt</a>().</p>
<!-- @@@indexData -->
<!-- $$$indexData$$$indexData -->
<h3 class="fn" id="indexData-2"><a name="indexData-2"></a>const <span class="type">void</span> * QSGGeometry::<span class="name">indexData</span>() const</h3>
<p>Returns a pointer to the raw index data of this geometry object.</p>
<p><b>See also </b><a href="qsggeometry.html#indexDataAsUShort">indexDataAsUShort</a>() and <a href="qsggeometry.html#indexDataAsUInt">indexDataAsUInt</a>().</p>
<!-- @@@indexData -->
<!-- $$$indexDataAsUInt[overload1]$$$indexDataAsUInt -->
<h3 class="fn" id="indexDataAsUInt"><a name="indexDataAsUInt"></a><span class="type">uint</span> * QSGGeometry::<span class="name">indexDataAsUInt</span>()</h3>
<p>Convenience function to access the index data as a mutable array of 32-bit unsigned integers.</p>
<!-- @@@indexDataAsUInt -->
<!-- $$$indexDataAsUInt$$$indexDataAsUInt -->
<h3 class="fn" id="indexDataAsUInt-2"><a name="indexDataAsUInt-2"></a>const <span class="type">uint</span> * QSGGeometry::<span class="name">indexDataAsUInt</span>() const</h3>
<p>Convenience function to access the index data as an immutable array of 32-bit unsigned integers.</p>
<!-- @@@indexDataAsUInt -->
<!-- $$$indexDataAsUShort[overload1]$$$indexDataAsUShort -->
<h3 class="fn" id="indexDataAsUShort"><a name="indexDataAsUShort"></a><span class="type">quint16</span> * QSGGeometry::<span class="name">indexDataAsUShort</span>()</h3>
<p>Convenience function to access the index data as a mutable array of 16-bit unsigned integers.</p>
<!-- @@@indexDataAsUShort -->
<!-- $$$indexDataAsUShort$$$indexDataAsUShort -->
<h3 class="fn" id="indexDataAsUShort-2"><a name="indexDataAsUShort-2"></a>const <span class="type">quint16</span> * QSGGeometry::<span class="name">indexDataAsUShort</span>() const</h3>
<p>Convenience function to access the index data as an immutable array of 16-bit unsigned integers.</p>
<!-- @@@indexDataAsUShort -->
<!-- $$$indexDataPattern[overload1]$$$indexDataPattern -->
<h3 class="fn" id="indexDataPattern"><a name="indexDataPattern"></a><span class="type"><a href="qsggeometry.html#DataPattern-enum">DataPattern</a></span> QSGGeometry::<span class="name">indexDataPattern</span>() const</h3>
<p>Returns the usage pattern for indices in this geometry. The default pattern is <a href="qsggeometry.html#DataPattern-enum">AlwaysUploadPattern</a>.</p>
<p><b>See also </b><a href="qsggeometry.html#setIndexDataPattern">setIndexDataPattern</a>().</p>
<!-- @@@indexDataPattern -->
<!-- $$$indexType[overload1]$$$indexType -->
<h3 class="fn" id="indexType"><a name="indexType"></a><span class="type">int</span> QSGGeometry::<span class="name">indexType</span>() const</h3>
<p>Returns the primitive type used for indices in this geometry object.</p>
<!-- @@@indexType -->
<!-- $$$lineWidth[overload1]$$$lineWidth -->
<h3 class="fn" id="lineWidth"><a name="lineWidth"></a><span class="type">float</span> QSGGeometry::<span class="name">lineWidth</span>() const</h3>
<p>Gets the current line or point width or to be used for this geometry. This property only applies to line width when the <a href="qsggeometry.html#drawingMode">drawingMode</a> is <code>GL_LINES</code>, <code>GL_LINE_STRIP</code>, or <code>GL_LINE_LOOP</code>. For desktop OpenGL, it also applies to point size when the <a href="qsggeometry.html#drawingMode">drawingMode</a> is <code>GL_POINTS</code>.</p>
<p>The default value is <code>1.0</code></p>
<p><b>See also </b><a href="qsggeometry.html#setLineWidth">setLineWidth</a>() and <a href="qsggeometry.html#drawingMode">drawingMode</a>().</p>
<!-- @@@lineWidth -->
<!-- $$$markIndexDataDirty[overload1]$$$markIndexDataDirty -->
<h3 class="fn" id="markIndexDataDirty"><a name="markIndexDataDirty"></a><span class="type">void</span> QSGGeometry::<span class="name">markIndexDataDirty</span>()</h3>
<p>Mark that the vertices in this geometry has changed and must be uploaded again.</p>
<p>This function only has an effect when the usage pattern for vertices is StaticData and the renderer that renders this geometry uploads the geometry into Vertex Buffer Objects (VBOs).</p>
<!-- @@@markIndexDataDirty -->
<!-- $$$markVertexDataDirty[overload1]$$$markVertexDataDirty -->
<h3 class="fn" id="markVertexDataDirty"><a name="markVertexDataDirty"></a><span class="type">void</span> QSGGeometry::<span class="name">markVertexDataDirty</span>()</h3>
<p>Mark that the vertices in this geometry has changed and must be uploaded again.</p>
<p>This function only has an effect when the usage pattern for vertices is StaticData and the renderer that renders this geometry uploads the geometry into Vertex Buffer Objects (VBOs).</p>
<!-- @@@markVertexDataDirty -->
<!-- $$$setDrawingMode[overload1]$$$setDrawingModeGLenum -->
<h3 class="fn" id="setDrawingMode"><a name="setDrawingMode"></a><span class="type">void</span> QSGGeometry::<span class="name">setDrawingMode</span>(<span class="type">GLenum</span><i> mode</i>)</h3>
<p>Sets the <i>mode</i> to be used for drawing this geometry.</p>
<p>The default value is <code>GL_TRIANGLE_STRIP</code>.</p>
<p><b>See also </b><a href="qsggeometry.html#drawingMode">drawingMode</a>().</p>
<!-- @@@setDrawingMode -->
<!-- $$$setIndexDataPattern[overload1]$$$setIndexDataPatternDataPattern -->
<h3 class="fn" id="setIndexDataPattern"><a name="setIndexDataPattern"></a><span class="type">void</span> QSGGeometry::<span class="name">setIndexDataPattern</span>(<span class="type"><a href="qsggeometry.html#DataPattern-enum">DataPattern</a></span><i> p</i>)</h3>
<p>Sets the usage pattern for indices to <i>p</i>.</p>
<p>The default is <a href="qsggeometry.html#DataPattern-enum">AlwaysUploadPattern</a>. When set to anything other than the default, the user must call <a href="qsggeometry.html#markIndexDataDirty">markIndexDataDirty</a>() after changing the index data, in addition to calling <a href="qsgnode.html#markDirty">QSGNode::markDirty</a>() with <a href="qsgnode.html#DirtyStateBit-enum">QSGNode::DirtyGeometry</a>.</p>
<p><b>See also </b><a href="qsggeometry.html#indexDataPattern">indexDataPattern</a>().</p>
<!-- @@@setIndexDataPattern -->
<!-- $$$setLineWidth[overload1]$$$setLineWidthfloat -->
<h3 class="fn" id="setLineWidth"><a name="setLineWidth"></a><span class="type">void</span> QSGGeometry::<span class="name">setLineWidth</span>(<span class="type">float</span><i> width</i>)</h3>
<p>Sets the line or point width to be used for this geometry to <i>width</i>. This property only applies to line width when the <a href="qsggeometry.html#drawingMode">drawingMode</a> is <code>GL_LINES</code>, <code>GL_LINE_STRIP</code>, or <code>GL_LINE_LOOP</code>. For Desktop OpenGL, it also applies to point size when the <a href="qsggeometry.html#drawingMode">drawingMode</a> is <code>GL_POINTS</code>.</p>
<p><b>Note: </b>How line width and point size are treated is implementation dependent: The application should not rely on these, but rather create triangles or similar to draw areas. On OpenGL ES, line width support is limited and point size is unsupported.</p><p><b>See also </b><a href="qsggeometry.html#lineWidth">lineWidth</a>() and <a href="qsggeometry.html#drawingMode">drawingMode</a>().</p>
<!-- @@@setLineWidth -->
<!-- $$$setVertexDataPattern[overload1]$$$setVertexDataPatternDataPattern -->
<h3 class="fn" id="setVertexDataPattern"><a name="setVertexDataPattern"></a><span class="type">void</span> QSGGeometry::<span class="name">setVertexDataPattern</span>(<span class="type"><a href="qsggeometry.html#DataPattern-enum">DataPattern</a></span><i> p</i>)</h3>
<p>Sets the usage pattern for vertices to <i>p</i>.</p>
<p>The default is <a href="qsggeometry.html#DataPattern-enum">AlwaysUploadPattern</a>. When set to anything other than the default, the user must call <a href="qsggeometry.html#markVertexDataDirty">markVertexDataDirty</a>() after changing the vertex data, in addition to calling <a href="qsgnode.html#markDirty">QSGNode::markDirty</a>() with <a href="qsgnode.html#DirtyStateBit-enum">QSGNode::DirtyGeometry</a>.</p>
<p><b>See also </b><a href="qsggeometry.html#vertexDataPattern">vertexDataPattern</a>().</p>
<!-- @@@setVertexDataPattern -->
<!-- $$$sizeOfIndex[overload1]$$$sizeOfIndex -->
<h3 class="fn" id="sizeOfIndex"><a name="sizeOfIndex"></a><span class="type">int</span> QSGGeometry::<span class="name">sizeOfIndex</span>() const</h3>
<p>Returns the byte size of the index type.</p>
<p>This value is either <code>1</code> when index type is <code>GL_UNSIGNED_BYTE</code> or <code>2</code> when index type is <code>GL_UNSIGNED_SHORT</code>. For Desktop OpenGL, <code>GL_UNSIGNED_INT</code> with the value <code>4</code> is also supported.</p>
<!-- @@@sizeOfIndex -->
<!-- $$$sizeOfVertex[overload1]$$$sizeOfVertex -->
<h3 class="fn" id="sizeOfVertex"><a name="sizeOfVertex"></a><span class="type">int</span> QSGGeometry::<span class="name">sizeOfVertex</span>() const</h3>
<p>Returns the size in bytes of one vertex.</p>
<p>This value comes from the attributes.</p>
<!-- @@@sizeOfVertex -->
<!-- $$$updateRectGeometry[overload1]$$$updateRectGeometryQSGGeometry*constQRectF& -->
<h3 class="fn" id="updateRectGeometry"><a name="updateRectGeometry"></a><code>[static] </code><span class="type">void</span> QSGGeometry::<span class="name">updateRectGeometry</span>(<span class="type"><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></span> *<i> g</i>, const <span class="type">QRectF</span> &<i> rect</i>)</h3>
<p>Updates the geometry <i>g</i> with the coordinates in <i>rect</i>.</p>
<p>The function assumes the geometry object contains a single triangle strip of <a href="qsggeometry-point2d.html">QSGGeometry::Point2D</a> vertices</p>
<!-- @@@updateRectGeometry -->
<!-- $$$updateTexturedRectGeometry[overload1]$$$updateTexturedRectGeometryQSGGeometry*constQRectF&constQRectF& -->
<h3 class="fn" id="updateTexturedRectGeometry"><a name="updateTexturedRectGeometry"></a><code>[static] </code><span class="type">void</span> QSGGeometry::<span class="name">updateTexturedRectGeometry</span>(<span class="type"><a href="qsggeometry.html#QSGGeometry">QSGGeometry</a></span> *<i> g</i>, const <span class="type">QRectF</span> &<i> rect</i>, const <span class="type">QRectF</span> &<i> textureRect</i>)</h3>
<p>Updates the geometry <i>g</i> with the coordinates in <i>rect</i> and texture coordinates from <i>textureRect</i>.</p>
<p><i>textureRect</i> should be in normalized coordinates.</p>
<p><i>g</i> is assumed to be a triangle strip of four vertices of type <a href="qsggeometry-texturedpoint2d.html">QSGGeometry::TexturedPoint2D</a>.</p>
<!-- @@@updateTexturedRectGeometry -->
<!-- $$$vertexCount[overload1]$$$vertexCount -->
<h3 class="fn" id="vertexCount"><a name="vertexCount"></a><span class="type">int</span> QSGGeometry::<span class="name">vertexCount</span>() const</h3>
<p>Returns the number of vertices in this geometry object.</p>
<!-- @@@vertexCount -->
<!-- $$$vertexData[overload1]$$$vertexData -->
<h3 class="fn" id="vertexData"><a name="vertexData"></a><span class="type">void</span> * QSGGeometry::<span class="name">vertexData</span>()</h3>
<p>Returns a pointer to the raw vertex data of this geometry object.</p>
<p><b>See also </b><a href="qsggeometry.html#vertexDataAsPoint2D">vertexDataAsPoint2D</a>() and <a href="qsggeometry.html#vertexDataAsTexturedPoint2D">vertexDataAsTexturedPoint2D</a>().</p>
<!-- @@@vertexData -->
<!-- $$$vertexData$$$vertexData -->
<h3 class="fn" id="vertexData-2"><a name="vertexData-2"></a>const <span class="type">void</span> * QSGGeometry::<span class="name">vertexData</span>() const</h3>
<p>Returns a pointer to the raw vertex data of this geometry object.</p>
<p><b>See also </b><a href="qsggeometry.html#vertexDataAsPoint2D">vertexDataAsPoint2D</a>() and <a href="qsggeometry.html#vertexDataAsTexturedPoint2D">vertexDataAsTexturedPoint2D</a>().</p>
<!-- @@@vertexData -->
<!-- $$$vertexDataAsColoredPoint2D[overload1]$$$vertexDataAsColoredPoint2D -->
<h3 class="fn" id="vertexDataAsColoredPoint2D"><a name="vertexDataAsColoredPoint2D"></a><span class="type"><a href="qsggeometry-coloredpoint2d.html">ColoredPoint2D</a></span> * QSGGeometry::<span class="name">vertexDataAsColoredPoint2D</span>()</h3>
<p>Convenience function to access the vertex data as a mutable array of <a href="qsggeometry-coloredpoint2d.html">QSGGeometry::ColoredPoint2D</a>.</p>
<!-- @@@vertexDataAsColoredPoint2D -->
<!-- $$$vertexDataAsColoredPoint2D$$$vertexDataAsColoredPoint2D -->
<h3 class="fn" id="vertexDataAsColoredPoint2D-2"><a name="vertexDataAsColoredPoint2D-2"></a>const <span class="type"><a href="qsggeometry-coloredpoint2d.html">ColoredPoint2D</a></span> * QSGGeometry::<span class="name">vertexDataAsColoredPoint2D</span>() const</h3>
<p>Convenience function to access the vertex data as an immutable array of <a href="qsggeometry-coloredpoint2d.html">QSGGeometry::ColoredPoint2D</a>.</p>
<!-- @@@vertexDataAsColoredPoint2D -->
<!-- $$$vertexDataAsPoint2D[overload1]$$$vertexDataAsPoint2D -->
<h3 class="fn" id="vertexDataAsPoint2D"><a name="vertexDataAsPoint2D"></a><span class="type"><a href="qsggeometry-point2d.html">Point2D</a></span> * QSGGeometry::<span class="name">vertexDataAsPoint2D</span>()</h3>
<p>Convenience function to access the vertex data as a mutable array of <a href="qsggeometry-point2d.html">QSGGeometry::Point2D</a>.</p>
<!-- @@@vertexDataAsPoint2D -->
<!-- $$$vertexDataAsPoint2D$$$vertexDataAsPoint2D -->
<h3 class="fn" id="vertexDataAsPoint2D-2"><a name="vertexDataAsPoint2D-2"></a>const <span class="type"><a href="qsggeometry-point2d.html">Point2D</a></span> * QSGGeometry::<span class="name">vertexDataAsPoint2D</span>() const</h3>
<p>Convenience function to access the vertex data as an immutable array of <a href="qsggeometry-point2d.html">QSGGeometry::Point2D</a>.</p>
<!-- @@@vertexDataAsPoint2D -->
<!-- $$$vertexDataAsTexturedPoint2D[overload1]$$$vertexDataAsTexturedPoint2D -->
<h3 class="fn" id="vertexDataAsTexturedPoint2D"><a name="vertexDataAsTexturedPoint2D"></a><span class="type"><a href="qsggeometry-texturedpoint2d.html">TexturedPoint2D</a></span> * QSGGeometry::<span class="name">vertexDataAsTexturedPoint2D</span>()</h3>
<p>Convenience function to access the vertex data as a mutable array of <a href="qsggeometry-texturedpoint2d.html">QSGGeometry::TexturedPoint2D</a>.</p>
<!-- @@@vertexDataAsTexturedPoint2D -->
<!-- $$$vertexDataAsTexturedPoint2D$$$vertexDataAsTexturedPoint2D -->
<h3 class="fn" id="vertexDataAsTexturedPoint2D-2"><a name="vertexDataAsTexturedPoint2D-2"></a>const <span class="type"><a href="qsggeometry-texturedpoint2d.html">TexturedPoint2D</a></span> * QSGGeometry::<span class="name">vertexDataAsTexturedPoint2D</span>() const</h3>
<p>Convenience function to access the vertex data as an immutable array of <a href="qsggeometry-texturedpoint2d.html">QSGGeometry::TexturedPoint2D</a>.</p>
<!-- @@@vertexDataAsTexturedPoint2D -->
<!-- $$$vertexDataPattern[overload1]$$$vertexDataPattern -->
<h3 class="fn" id="vertexDataPattern"><a name="vertexDataPattern"></a><span class="type"><a href="qsggeometry.html#DataPattern-enum">DataPattern</a></span> QSGGeometry::<span class="name">vertexDataPattern</span>() const</h3>
<p>Returns the usage pattern for vertices in this geometry. The default pattern is <a href="qsggeometry.html#DataPattern-enum">AlwaysUploadPattern</a>.</p>
<p><b>See also </b><a href="qsggeometry.html#setVertexDataPattern">setVertexDataPattern</a>().</p>
<!-- @@@vertexDataPattern -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|