mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +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 <QNetworkProxyFactory>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QSurfaceFormat>
|
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#ifdef Q_OS_ANDROID
|
#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" */
|
"QThreadStorage: Thread X exited after QThreadStorage Y destroyed" */
|
||||||
Downloader::setNetworkManager(new QNetworkAccessManager(this));
|
Downloader::setNetworkManager(new QNetworkAccessManager(this));
|
||||||
DEM::setDir(ProgramPaths::demDir());
|
DEM::setDir(ProgramPaths::demDir());
|
||||||
QSurfaceFormat fmt;
|
|
||||||
fmt.setStencilBufferSize(8);
|
|
||||||
fmt.setSamples(4);
|
|
||||||
QSurfaceFormat::setDefaultFormat(fmt);
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
QImageReader::setAllocationLimit(0);
|
QImageReader::setAllocationLimit(0);
|
||||||
#endif // QT6
|
#endif // QT6
|
||||||
|
15
src/main.cpp
15
src/main.cpp
@ -1,3 +1,5 @@
|
|||||||
|
#include <QtGlobal>
|
||||||
|
#include <QSurfaceFormat>
|
||||||
#include "GUI/app.h"
|
#include "GUI/app.h"
|
||||||
#include "GUI/timezoneinfo.h"
|
#include "GUI/timezoneinfo.h"
|
||||||
|
|
||||||
@ -12,6 +14,19 @@ int main(int argc, char *argv[])
|
|||||||
qRegisterMetaType<TimeZoneInfo>("TimeZoneInfo");
|
qRegisterMetaType<TimeZoneInfo>("TimeZoneInfo");
|
||||||
#endif // QT6
|
#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);
|
App app(argc, argv);
|
||||||
return app.run();
|
return app.run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user