QSGGeometry ClassThe QSGGeometry class provides low-level storage for graphics primitives in the QML Scene Graph. More... #include <QSGGeometry>
Public Types
Public Functions
Static Public Members
Detailed DescriptionThe QSGGeometry class provides low-level storage for graphics primitives in the QML Scene Graph. The QSGGeometry class provides a few convenience attributes and attribute accessors by default. The defaultAttributes_Point2D() function returns attributes to be used in normal solid color rectangles, while the defaultAttributes_TexturedPoint2D function returns attributes to be used for the common pixmap usecase. Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QSGGeometry::AlwaysUploadPattern | 0 | 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. |
QSGGeometry::DynamicPattern | 2 | 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. |
QSGGeometry::StaticPattern | 3 | 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. |
Constructs a geometry object based on attributes.
The object allocate space for vertexCount vertices based on the accumulated size in attributes and for indexCount.
Geometry objects are constructed with GL_TRIANGLE_STRIP as default drawing mode.
The attribute structure is assumed to be POD and the geometry object assumes this will not go away. There is no memory management involved.
Resizes the vertex and index data of this geometry object to fit vertexCount vertices and indexCount indices.
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(QSGNode::DirtyGeometry) to ensure that the renderer has a chance to update internal buffers.
Convenience function which returns attributes to be used for per vertex colored 2D drawing.
Convenience function which returns attributes to be used for 2D solid color drawing.
Convenience function which returns attributes to be used for textured 2D drawing.
Returns the drawing mode of this geometry.
The default value is GL_TRIANGLE_STRIP.
See also setDrawingMode().
Returns the number of indices in this geometry object.
Returns a pointer to the raw index data of this geometry object.
See also indexDataAsUShort() and indexDataAsUInt().
Returns a pointer to the raw index data of this geometry object.
See also indexDataAsUShort() and indexDataAsUInt().
Returns the usage pattern for indices in this geometry. The default pattern is AlwaysUploadPattern.
See also setIndexDataPattern().
Returns the primitive type used for indices in this geometry object.
Gets the current line width to be used for this geometry. This property only applies where the drawingMode is GL_LINES or a related value.
The default value is 1.0
See also setLineWidth() and drawingMode().
Mark that the vertices in this geometry has changed and must be uploaded again.
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).
Mark that the vertices in this geometry has changed and must be uploaded again.
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).
Sets the drawing mode to be used for this geometry.
The default value is GL_TRIANGLE_STRIP.
See also drawingMode().
Sets the usage pattern for indices to p.
The default is AlwaysUploadPattern. When set to anything other than the default, the user must call markIndexDataDirty() after changing the index data.
See also indexDataPattern().
Sets the line width to be used for this geometry. This property only applies where the drawingMode is GL_LINES or a related value.
See also lineWidth() and drawingMode().
Sets the usage pattern for vertices to p.
The default is AlwaysUploadPattern. When set to anything other than the default, the user must call markVertexDataDirty() after changing the vertex data.
See also vertexDataPattern().
Returns the byte size of the index type.
This value is either 1 when index type is GL_UNSIGNED_BYTE or 2 when index type is GL_UNSIGNED_SHORT. For Desktop OpenGL, GL_UNSIGNED_INT with the value 4 is also supported.
Returns the size in bytes of one vertex.
This value comes from the attributes.
Updates the geometry g with the coordinates in rect.
The function assumes the geometry object contains a single triangle strip of QSGGeometry::Point2D vertices
Updates the geometry g with the coordinates in rect and texture coordinates from textureRect.
textureRect should be in normalized coordinates.
g is assumed to be a triangle strip of four vertices of type QSGGeometry::TexturedPoint2D.
Returns the number of vertices in this geometry object.
Returns a pointer to the raw vertex data of this geometry object.
See also vertexDataAsPoint2D() and vertexDataAsTexturedPoint2D.
Returns a pointer to the raw vertex data of this geometry object.
See also vertexDataAsPoint2D() and vertexDataAsTexturedPoint2D.
Returns the usage pattern for vertices in this geometry. The default pattern is AlwaysUploadPattern.
See also setVertexDataPattern().