aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi
diff options
context:
space:
mode:
authorBerthold Krevert <berthold.krevert@basyskom.com>2015-02-04 10:18:36 +0100
committerBerthold Krevert <berthold.krevert@basyskom.com>2015-02-04 15:24:08 +0000
commit7d4bf1868d298a0bdc3f83ada6befb9ba4389cf5 (patch)
treead9cab18ef3263f2e53e3acdf8bde6efb3d3ed96 /src/quick/scenegraph/coreapi
parentec699494f537902e756ac317a5bbe52694cc4223 (diff)
Use correct QOpenGLFunctions object
If core profile is used, QOpenGLContext::versionFunctions returns 0 if a legacy or a non-core profile version is requested. That means, when using core profile we have to request a QOpenGLFunctions_3_2_Core object (which is the lowest OpenGL version that comes with profiles). Otherwise the application would run into a segfault. Change-Id: I8119e5fbeafccf14d59680617172c71e60e188ce Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 688a5fcb44..bd91841b1c 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -46,6 +46,7 @@
#include <QtGui/QOpenGLFramebufferObject>
#include <QtGui/QOpenGLVertexArrayObject>
#include <QtGui/QOpenGLFunctions_1_0>
+#include <QtGui/QOpenGLFunctions_3_2_Core>
#include <private/qquickprofiler_p.h>
#include "qsgmaterialshader_p.h"
@@ -2411,9 +2412,20 @@ void Renderer::renderUnmergedBatch(const Batch *batch)
glLineWidth(g->lineWidth());
#if !defined(QT_OPENGL_ES_2)
else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) {
- QOpenGLFunctions_1_0 *gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>();
- gl1funcs->initializeOpenGLFunctions();
- gl1funcs->glPointSize(g->lineWidth());
+ QOpenGLFunctions_1_0 *gl1funcs = 0;
+ QOpenGLFunctions_3_2_Core *gl3funcs = 0;
+ if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) {
+ gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
+ gl3funcs->initializeOpenGLFunctions();
+ } else {
+ gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>();
+ gl1funcs->initializeOpenGLFunctions();
+ }
+ Q_ASSERT(gl1funcs || gl3funcs);
+ if (gl1funcs)
+ gl1funcs->glPointSize(g->lineWidth());
+ else
+ gl3funcs->glPointSize(g->lineWidth());
}
#endif