diff options
Diffstat (limited to 'platform/qt/src')
-rw-r--r-- | platform/qt/src/headless_backend_qt.cpp | 30 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 2 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl_p.hpp | 2 |
3 files changed, 17 insertions, 17 deletions
diff --git a/platform/qt/src/headless_backend_qt.cpp b/platform/qt/src/headless_backend_qt.cpp index 7985ca9f2d..ad3fa42290 100644 --- a/platform/qt/src/headless_backend_qt.cpp +++ b/platform/qt/src/headless_backend_qt.cpp @@ -12,9 +12,19 @@ namespace mbgl { -class QtImpl : public HeadlessBackend::Impl { +class QtBackendImpl : public HeadlessBackend::Impl { public: - ~QtImpl() final = default; + ~QtBackendImpl() final = default; + + gl::ProcAddress getExtensionFunctionPointer(const char* name) final { +#if QT_VERSION >= 0x050000 + QOpenGLContext* thisContext = QOpenGLContext::currentContext(); + return thisContext->getProcAddress(name); +#else + const QGLContext* thisContext = QGLContext::currentContext(); + return reinterpret_cast<gl::ProcAddress>(thisContext->getProcAddress(name)); +#endif + } void activateContext() final { widget.makeCurrent(); @@ -28,19 +38,9 @@ private: QGLWidget widget; }; -gl::ProcAddress HeadlessBackend::initializeExtension(const char* name) { -#if QT_VERSION >= 0x050000 - QOpenGLContext* thisContext = QOpenGLContext::currentContext(); - return thisContext->getProcAddress(name); -#else - const QGLContext* thisContext = QGLContext::currentContext(); - return reinterpret_cast<gl::ProcAddress>(thisContext->getProcAddress(name)); -#endif -} - -void HeadlessBackend::createContext() { - assert(!hasContext()); - impl = std::make_unique<QtImpl>(); +void HeadlessBackend::createImpl() { + assert(!impl); + impl = std::make_unique<QtBackendImpl>(); } } // namespace mbgl diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index cc1d88e22f..2675d87862 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1695,7 +1695,7 @@ void QMapboxGLPrivate::onSourceChanged(mbgl::style::Source&) Initializes an OpenGL extension function such as Vertex Array Objects (VAOs), required by Mapbox GL Native engine. */ -mbgl::gl::ProcAddress QMapboxGLPrivate::initializeExtension(const char* name) { +mbgl::gl::ProcAddress QMapboxGLPrivate::getExtensionFunctionPointer(const char* name) { #if QT_VERSION >= 0x050000 QOpenGLContext* thisContext = QOpenGLContext::currentContext(); return thisContext->getProcAddress(name); diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp index 5e12b44a20..f947c09f48 100644 --- a/platform/qt/src/qmapboxgl_p.hpp +++ b/platform/qt/src/qmapboxgl_p.hpp @@ -61,7 +61,7 @@ public: bool dirty { false }; private: - mbgl::gl::ProcAddress initializeExtension(const char*) override; + mbgl::gl::ProcAddress getExtensionFunctionPointer(const char*) override; public slots: void connectionEstablished(); |