[Qt] Initialize GL extensions
It will also enable Vertex Array Objects.
This commit is contained in:
@@ -60,6 +60,10 @@ typedef void (*CustomLayerInitializeFunction)(void* context) ;
|
||||
typedef void (*CustomLayerRenderFunction)(void* context, const CustomLayerRenderParameters&);
|
||||
typedef void (*CustomLayerDeinitializeFunction)(void* context);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_DECL_EXPORT void initializeGLExtensions();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(QMapbox::Coordinate);
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#include <mbgl/gl/gl.hpp>
|
||||
#include <mbgl/storage/network_status.hpp>
|
||||
#include <mbgl/util/default_styles.hpp>
|
||||
|
||||
#include <QMapbox>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QOpenGLContext>
|
||||
#endif
|
||||
|
||||
namespace QMapbox {
|
||||
|
||||
Q_DECL_EXPORT NetworkMode networkMode()
|
||||
@@ -44,4 +49,14 @@ 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) {
|
||||
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
|
||||
return thisContext->getProcAddress(name);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
QQuickMapboxGLRenderer::QQuickMapboxGLRenderer()
|
||||
{
|
||||
QMapbox::initializeGLExtensions();
|
||||
|
||||
QMapboxGLSettings settings;
|
||||
settings.setAccessToken(qgetenv("MAPBOX_ACCESS_TOKEN"));
|
||||
settings.setCacheDatabasePath("/tmp/mbgl-cache.db");
|
||||
|
||||
Reference in New Issue
Block a user