summaryrefslogtreecommitdiff
path: root/platform/qt/src/qmapbox.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-13 13:15:45 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-13 13:28:49 +0300
commitd36111abedf0d13d6078e6c75d55668bb8786141 (patch)
treed5ff63171ead36e675de058fe2416b5af3f253c4 /platform/qt/src/qmapbox.cpp
parent3d4e0d66fea188c61f33fbf234eeaebc50bc9e40 (diff)
downloadqtlocation-mapboxgl-d36111abedf0d13d6078e6c75d55668bb8786141.tar.gz
[Qt] Initialize GL extensions on MapWindow
QMapboxGL relies on its embedding widget to call for the GL extensions initialization function. Fixes #5024.
Diffstat (limited to 'platform/qt/src/qmapbox.cpp')
-rw-r--r--platform/qt/src/qmapbox.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/platform/qt/src/qmapbox.cpp b/platform/qt/src/qmapbox.cpp
index bc60ce3e5a..17ddbe4ca5 100644
--- a/platform/qt/src/qmapbox.cpp
+++ b/platform/qt/src/qmapbox.cpp
@@ -7,6 +7,8 @@
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
+#else
+#include <QGLContext>
#endif
// mbgl::MapMode
@@ -39,14 +41,17 @@ Q_DECL_EXPORT QList<QPair<QString, QString>>& defaultStyles()
return styles;
}
-#if QT_VERSION >= 0x050000
Q_DECL_EXPORT void initializeGLExtensions()
{
mbgl::gl::InitializeExtensions([](const char* name) {
+#if QT_VERSION >= 0x050000
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
+#else
+ const QGLContext* thisContext = QGLContext::currentContext();
+ return reinterpret_cast<mbgl::gl::glProc>(thisContext->getProcAddress(name));
+#endif
});
}
-#endif
}