1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Do the OpenGL initialization before QApplication is created

This commit is contained in:
Martin Tůma 2024-02-03 16:41:38 +01:00
parent 5eb0dfc9b1
commit d61528c33f
2 changed files with 15 additions and 5 deletions

View File

@ -5,7 +5,6 @@
#include <QNetworkProxyFactory>
#include <QNetworkAccessManager>
#include <QLibraryInfo>
#include <QSurfaceFormat>
#include <QImageReader>
#include <QFileInfo>
#ifdef Q_OS_ANDROID
@ -58,10 +57,6 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
"QThreadStorage: Thread X exited after QThreadStorage Y destroyed" */
Downloader::setNetworkManager(new QNetworkAccessManager(this));
DEM::setDir(ProgramPaths::demDir());
QSurfaceFormat fmt;
fmt.setStencilBufferSize(8);
fmt.setSamples(4);
QSurfaceFormat::setDefaultFormat(fmt);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QImageReader::setAllocationLimit(0);
#endif // QT6

View File

@ -1,3 +1,5 @@
#include <QtGlobal>
#include <QSurfaceFormat>
#include "GUI/app.h"
#include "GUI/timezoneinfo.h"
@ -12,6 +14,19 @@ int main(int argc, char *argv[])
qRegisterMetaType<TimeZoneInfo>("TimeZoneInfo");
#endif // QT6
QSurfaceFormat fmt;
fmt.setProfile(QSurfaceFormat::CoreProfile);
#ifdef Q_OS_ANDROID
fmt.setRenderableType(QSurfaceFormat::OpenGLES);
#else // Android
fmt.setVersion(3, 2);
fmt.setRenderableType(QSurfaceFormat::OpenGL);
#endif // Android
fmt.setDepthBufferSize(24);
fmt.setStencilBufferSize(8);
fmt.setSamples(4);
QSurfaceFormat::setDefaultFormat(fmt);
App app(argc, argv);
return app.run();
}