diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-05-20 10:25:31 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-05-23 08:06:16 +0000 |
commit | 592b5b49b6c0043fae5db7721689813ebd226032 (patch) | |
tree | f649d7143008b4207063a155ca830bf17d4be828 | |
parent | af3f256d79122bd8e4dde9b32886e52df98f3c8d (diff) |
Remove unnecessary ifdef in QSGGeometry
...and fix up the docs for the GL-mirroring enums.
Change-Id: Iafac2bdde2fd1ce6453809b3e3709c89d885f7dc
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.cpp | 79 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.h | 11 |
2 files changed, 60 insertions, 30 deletions
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 64635edc4f..7ec72a6e10 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -218,9 +218,9 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D() 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 OpenGL + 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. + \c GL_POINTS in case of OpenGL. 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 @@ -527,29 +527,63 @@ 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. + + \value DrawPoints + \value DrawLines + \value DrawLineLoop + \value DrawLineStrip + \value DrawTriangles + \value DrawTriangleStrip + \value DrawTriangleFan + */ + +/*! + \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. + + \value TypeByte + \value TypeUnsignedByte + \value TypeShort + \value TypeUnsignedShort + \value TypeInt + \value TypeUnsignedInt + \value TypeFloat + */ + +/*! Sets the \a mode to be used for drawing this geometry. - The default value is \c GL_TRIANGLE_STRIP. + The default value is QSGGeometry::DrawTriangleStrip. + + \sa DrawingMode */ -#ifndef QT_NO_OPENGL -void QSGGeometry::setDrawingMode(GLenum mode) +void QSGGeometry::setDrawingMode(unsigned int mode) { m_drawing_mode = mode; } -#else -void QSGGeometry::setDrawingMode(int mode) -{ - m_drawing_mode = mode; -} -#endif + /*! - 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 \c GL_LINES, \c GL_LINE_STRIP, or - \c GL_LINE_LOOP. For desktop OpenGL, it also applies to point size when the drawingMode - is \c GL_POINTS. + 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. 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. + \sa setLineWidth(), drawingMode() */ float QSGGeometry::lineWidth() const @@ -558,14 +592,15 @@ 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 \c GL_LINES, \c GL_LINE_STRIP, or - \c GL_LINE_LOOP. For Desktop OpenGL, it also applies to point size when the drawingMode - is \c GL_POINTS. + 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. - \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 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. \sa lineWidth(), drawingMode() */ diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index 8d0cd03968..1f54b7d81b 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -144,14 +144,9 @@ public: int indexType = TypeUnsignedShort); virtual ~QSGGeometry(); -#ifndef QT_NO_OPENGL - // ### Qt 6: GL types to be removed from the public API - void setDrawingMode(GLenum mode); - inline GLenum drawingMode() const { return m_drawing_mode; } -#else - void setDrawingMode(int mode); - inline int drawingMode() const { return m_drawing_mode; } -#endif + // must use unsigned int to be compatible with the old GLenum to keep BC + void setDrawingMode(unsigned int mode); + inline unsigned int drawingMode() const { return m_drawing_mode; } void allocate(int vertexCount, int indexCount = 0); |