summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-02-28 18:39:43 -0800
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-01 09:25:52 -0800
commitf28d75dccd9bf4a7615df87faccc5cf5eff8df89 (patch)
tree2957feeebff3fbd31a44b0b91c93f20176c156fd
parent74d42a45e2bad5318813e5e2c006d8a9bbda2c74 (diff)
downloadqtlocation-mapboxgl-f28d75dccd9bf4a7615df87faccc5cf5eff8df89.tar.gz
[Qt] FBO handling should happen outside of QMapboxGL::render
-rw-r--r--platform/qt/include/qmapboxgl.hpp8
-rw-r--r--platform/qt/src/qmapboxgl.cpp24
-rw-r--r--platform/qt/src/qmapboxgl_p.hpp4
-rw-r--r--platform/qt/src/qquickmapboxglrenderer.cpp4
4 files changed, 4 insertions, 36 deletions
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp
index f60ad8e677..af7ed6275f 100644
--- a/platform/qt/include/qmapboxgl.hpp
+++ b/platform/qt/include/qmapboxgl.hpp
@@ -10,10 +10,6 @@
#include <QString>
#include <QStringList>
-#if QT_VERSION >= 0x050000
-#include <QOpenGLFramebufferObject>
-#endif
-
class QMapboxGLPrivate;
// This header follows the Qt coding style: https://wiki.qt.io/Qt_Coding_Style
@@ -231,11 +227,7 @@ public:
void setFilter(const QString &layer, const QVariant &filter);
public slots:
-#if QT_VERSION >= 0x050000
- void render(QOpenGLFramebufferObject *fbo = NULL);
-#else
void render();
-#endif
void connectionEstablished();
signals:
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 9b6459f1e3..55470a65e1 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -28,7 +28,6 @@
#if QT_VERSION >= 0x050000
#include <QGuiApplication>
#include <QWindow>
-#include <QOpenGLFramebufferObject>
#include <QOpenGLContext>
#else
#include <QCoreApplication>
@@ -1492,17 +1491,9 @@ void QMapboxGL::setFilter(const QString& layer, const QVariant& filter)
This function should be called only after the signal needsRendering() is
emitted at least once.
*/
-#if QT_VERSION >= 0x050000
-void QMapboxGL::render(QOpenGLFramebufferObject *fbo)
-{
- d_ptr->dirty = false;
- d_ptr->fbo = fbo;
- d_ptr->mapObj->render(*d_ptr);
-}
-#else
void QMapboxGL::render()
{
-#if defined(__APPLE__)
+#if defined(__APPLE__) && QT_VERSION < 0x050000
// FIXME Qt 4.x provides an incomplete FBO at start.
// See https://bugreports.qt.io/browse/QTBUG-36802 for details.
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
@@ -1513,7 +1504,6 @@ void QMapboxGL::render()
d_ptr->dirty = false;
d_ptr->mapObj->render(*d_ptr);
}
-#endif
/*!
Informs the map that the network connection has been established, causing
@@ -1582,24 +1572,12 @@ QMapboxGLPrivate::~QMapboxGLPrivate()
{
}
-#if QT_VERSION >= 0x050000
-void QMapboxGLPrivate::bind() {
- if (fbo) {
- fbo->bind();
- getContext().bindFramebuffer.setDirty();
- getContext().viewport = {
- 0, 0, { static_cast<uint32_t>(fbo->width()), static_cast<uint32_t>(fbo->height()) }
- };
- }
-}
-#else
void QMapboxGLPrivate::bind() {
getContext().bindFramebuffer = 0;
getContext().viewport = {
0, 0, { static_cast<uint32_t>(fbSize.width()), static_cast<uint32_t>(fbSize.height()) }
};
}
-#endif
void QMapboxGLPrivate::invalidate()
{
diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp
index 6894e0de8b..ee7bff0872 100644
--- a/platform/qt/src/qmapboxgl_p.hpp
+++ b/platform/qt/src/qmapboxgl_p.hpp
@@ -43,10 +43,6 @@ public:
bool dirty { false };
-#if QT_VERSION >= 0x050000
- QOpenGLFramebufferObject *fbo { nullptr };
-#endif
-
public slots:
void connectionEstablished();
diff --git a/platform/qt/src/qquickmapboxglrenderer.cpp b/platform/qt/src/qquickmapboxglrenderer.cpp
index 69c22d35d7..133bed40e2 100644
--- a/platform/qt/src/qquickmapboxglrenderer.cpp
+++ b/platform/qt/src/qquickmapboxglrenderer.cpp
@@ -38,7 +38,9 @@ QOpenGLFramebufferObject* QQuickMapboxGLRenderer::createFramebufferObject(const
void QQuickMapboxGLRenderer::render()
{
- m_map->render(framebufferObject());
+ framebufferObject()->bind();
+ m_map->render();
+ framebufferObject()->release();
}
void QQuickMapboxGLRenderer::synchronize(QQuickFramebufferObject *item)