From 91c050b9c9cdcf0f9ed867065d4abaa51104f65b Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Tue, 16 Feb 2016 18:17:07 -0500 Subject: [PATCH] Move the buglist override to as early as possible, include switches for specific rendering backends on windows --- deploy/qgroundcontrol_installer.nsi | 2 ++ src/main.cc | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index 1b7a97172..1b1f1fcde 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -70,6 +70,8 @@ Section "create Start Menu Shortcuts" SetShellVarContext all CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\QGroundControl.lnk" "$INSTDIR\qgroundcontrol.exe" "" "$INSTDIR\qgroundcontrol.exe" 0 + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\QGroundControl (GPU Compatibility Mode).lnk" "$INSTDIR\qgroundcontrol.exe" "-angle" "$INSTDIR\qgroundcontrol.exe" 0 + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\QGroundControl (GPU Safe Mode).lnk" "$INSTDIR\qgroundcontrol.exe" "-swrast" "$INSTDIR\qgroundcontrol.exe" 0 SectionEnd Function .onInit diff --git a/src/main.cc b/src/main.cc index 3839800e7..22fdf1b1a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -139,9 +139,17 @@ int main(int argc, char *argv[]) #endif #endif - // install the message handler #ifdef Q_OS_WIN + // install the message handler qInstallMessageHandler(msgHandler); + + // Set our own OpenGL buglist + qputenv("QT_OPENGL_BUGLIST", ":/opengl/resources/opengl/buglist.json"); + if (QCoreApplication::arguments().contains(QStringLiteral("-angle"))) { + QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); + } else if (QCoreApplication::arguments().contains(QStringLiteral("-swrast"))) { + QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); + } #endif // The following calls to qRegisterMetaType are done to silence debug output which warns @@ -204,9 +212,6 @@ int main(int argc, char *argv[]) DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX); SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX); } - - // Set our own OpenGL buglist - qputenv("QT_OPENGL_BUGLIST", ":/opengl/resources/opengl/buglist.json"); #endif #endif // QT_DEBUG -- 2.22.0