aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-12 12:52:55 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-15 20:40:37 +0200
commitac4b9d10198ce38eb7108d758ca179aa76121c55 (patch)
tree6d1a1ae8434568fdc808125239c3b1cf4163396a /src/quick/scenegraph
parentab03621516630991c7cc0fea3be79879efed23a8 (diff)
Clean up QSGGeometry docs to not refer to OpenGL
Most of this is just updating based on the changes done back in Qt 5.8, e.g. referring to our own enum values instead talking about OpenGL and GL_*. Change-Id: Id4dd823acbb004d61a1b54cc4c92d1490d7f42a1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp84
1 files changed, 38 insertions, 46 deletions
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index 2e1cfebc6e..c8ecf49767 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -137,10 +137,6 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
hint should be set to \c true. The scene graph renderer may use this
information to perform optimizations.
- \note Scene graph backends for APIs other than OpenGL may require an
- accurate description of attributes' usage, and therefore it is recommended
- to use createWithAttributeType() instead.
-
Use the create function to construct the attribute, rather than an
initialization list, to ensure that all fields are initialized.
*/
@@ -229,12 +225,10 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
\inmodule QtQuick
- The QSGGeometry 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 setDrawingMode(), which maps directly to the graphics API's
- drawing mode, such as \c GL_TRIANGLE_STRIP, \c GL_TRIANGLES, or
- \c GL_POINTS in case of OpenGL.
+ The QSGGeometry 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, also called primitive
+ topology, is specified with setDrawingMode().
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
@@ -279,8 +273,8 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
};
QSGGeometry::Attribute MyPoint2D_Attributes[] = {
- QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true),
- QSGGeometry::Attribute::create(1, 4, GL_FLOAT, false)
+ QSGGeometry::Attribute::create(0, 2, FloatType, true),
+ QSGGeometry::Attribute::create(1, 4, FloatType, false)
};
QSGGeometry::AttributeSet MyPoint2D_AttributeSet = {
@@ -292,7 +286,7 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
...
geometry = new QSGGeometry(MyPoint2D_AttributeSet, 2);
- geometry->setDrawingMode(GL_LINES);
+ geometry->setDrawingMode(DrawLines);
MyPoint2D *vertices = static_cast<MyPoint2D *>(geometry->vertexData());
vertices[0].set(0, 0, 1, 0, 0, 1);
@@ -300,7 +294,7 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
\endcode
The QSGGeometry is a software buffer and client-side in terms of
- OpenGL rendering, as the buffers used in 2D graphics typically consist of
+ accelerated 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 QSGGeometry
supports hinting to the renderer that a buffer should be
@@ -405,12 +399,12 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
The object allocate space for \a vertexCount vertices based on the
accumulated size in \a attributes and for \a indexCount.
- The \a indexType maps to the OpenGL index type and can be
- \c GL_UNSIGNED_SHORT and \c GL_UNSIGNED_BYTE. On OpenGL implementations that
- support it, such as desktop OpenGL, \c GL_UNSIGNED_INT can also be used.
+ The \a indexType can be UnsignedShortType or \c
+ UnsignedIntType. Support for the latter depends on the graphics API
+ implementation used at run time, and may not always be available.
- Geometry objects are constructed with \c GL_TRIANGLE_STRIP as default
- drawing mode.
+ Geometry objects are constructed by default with DrawTriangleStrip as
+ the 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.
@@ -460,9 +454,8 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes,
Returns the byte size of the index type.
- This value is either \c 1 when index type is \c GL_UNSIGNED_BYTE or \c 2
- when index type is \c GL_UNSIGNED_SHORT. For Desktop OpenGL,
- \c GL_UNSIGNED_INT with the value \c 4 is also supported.
+ This value is either \c 2 when the index type is UnsignedShortType, or
+ \c 4 when the index type is UnsignedIntType.
*/
/*!
@@ -535,9 +528,7 @@ const void *QSGGeometry::indexData() const
/*!
\enum QSGGeometry::DrawingMode
- The values correspond to OpenGL enum values like \c GL_POINTS, \c GL_LINES,
- etc. QSGGeometry provies its own type in order to be able to provide the
- same API with non-OpenGL backends as well.
+ Specifies the drawing mode, also called primitive topology.
\value DrawPoints
\value DrawLines
@@ -551,9 +542,7 @@ const void *QSGGeometry::indexData() const
/*!
\enum QSGGeometry::Type
- The values correspond to OpenGL type constants like \c GL_BYTE, \c
- GL_UNSIGNED_BYTE, etc. QSGGeometry provies its own type in order to be able
- to provide the same API with non-OpenGL backends as well.
+ Specifies the component type in the vertex data.
\value ByteType
\value UnsignedByteType
@@ -581,18 +570,19 @@ void QSGGeometry::setDrawingMode(unsigned int mode)
}
/*!
- Gets the current line or point width or to be used for this geometry. This
- property only applies to line width when the drawingMode is DrawLines,
- DarwLineStrip, or DrawLineLoop. For desktop OpenGL, it also applies to
- point size when the drawingMode is DrawPoints.
+ Gets the current line or point width or to be used for this
+ geometry. This property only applies to line width when the drawingMode
+ is DrawLines, DarwLineStrip, or DrawLineLoop. When supported, it also
+ applies to point size when the drawingMode is DrawPoints.
The default value is \c 1.0
- \note When not using OpenGL, support for point and line drawing may be
- limited. For example, some APIs do not support point sprites and so setting
- a size other than 1 is not possible. Some backends may be able implement
- support via geometry shaders, but this is not guaranteed to be always
- available.
+ \note Support for point and line drawing may be limited at run time,
+ depending on the platform and graphics API. For example, some APIs do
+ not support point sprites and so setting a size other than 1 is not
+ possible.
+
+ \note The width of \c 1.0 is always supported.
\sa setLineWidth(), drawingMode()
*/
@@ -602,15 +592,17 @@ float QSGGeometry::lineWidth() const
}
/*!
- Sets the line or point width to be used for this geometry to \a width. This
- property only applies to line width when the drawingMode is DrawLines,
- DrawLineStrip, or DrawLineLoop. For Desktop OpenGL, it also applies to
- point size when the drawingMode is DrawPoints.
+ Sets the line or point width to be used for this geometry to \a
+ width. This property only applies to line width when the drawingMode is
+ DrawLines, DrawLineStrip, or DrawLineLoop. When supported, it also
+ applies to point size when the drawingMode is DrawPoints.
+
+ \note Support for point and line drawing may be limited at run time,
+ depending on the platform and graphics API. For example, some APIs do
+ not support point sprites and so setting a size other than 1 is not
+ possible.
- \note 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.
+ \note The width of \c 1.0 is always supported.
\sa lineWidth(), drawingMode()
*/
@@ -624,7 +616,7 @@ void QSGGeometry::setLineWidth(float width)
Returns the drawing mode of this geometry.
- The default value is \c GL_TRIANGLE_STRIP.
+ The default value is DrawTriangleStrip.
*/
/*!