mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Do the OpenGL initialization before QApplication is created
This commit is contained in:
parent
5eb0dfc9b1
commit
d61528c33f
@ -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
|
||||
|
15
src/main.cpp
15
src/main.cpp
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user