From 20f533671ab37be8a5868fecc64dc9d5e5e3ada0 Mon Sep 17 00:00:00 2001 From: Alex Montgomery Date: Mon, 6 Jan 2014 17:12:30 -0800 Subject: Use QSGGeometry::lineWidth() when drawing GL_POINTS Since glLineWidth doesn't affect the drawing of GL_POINTS, it makes sense to use the lineWidth member to affect point size when drawing points. [ChangeLog][QtQuick][QSGGeometry] Changed QSGGeometry::lineWidth to also affect point size (glPointSize) when drawing GL_POINTS, in addition to the existing behavior of affecting line width when drawing GL_LINES, GL_LINE_STRIP, and GL_LINE_LOOP. Task-number: QTBUG-35772 Change-Id: I0ea73f9261509e8d356f91a063dc90dc0f8980bd Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 4 ++++ src/quick/scenegraph/coreapi/qsggeometry.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index b1464a26cc..5a2096169b 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -2117,6 +2117,10 @@ void Renderer::renderUnmergedBatch(const Batch *batch) if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES) glLineWidth(g->lineWidth()); +#if !defined(QT_OPENGL_ES_2) + else if (g->drawingMode() == GL_POINTS) + glPointSize(g->lineWidth()); +#endif if (g->indexCount()) glDrawElements(g->drawingMode(), g->indexCount(), g->indexType(), iOffset); diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index ffb11fc6fa..40e0a014ab 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -525,8 +525,9 @@ void QSGGeometry::setDrawingMode(GLenum mode) } /*! - 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. + 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, and only applies to point size when the drawingMode is \c GL_POINTS. The default value is \c 1.0 @@ -538,8 +539,9 @@ float QSGGeometry::lineWidth() const } /*! - Sets the line width to be used for this geometry to \a width. The line width - only applies where the drawingMode is \c GL_LINES or a related value. + 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, and only applies to point size when the drawingMode is \c GL_POINTS. \sa lineWidth(), drawingMode() */ -- cgit v1.2.3