Browse Source

Allow configuration of bpp/buffer behavior

Change-Id: I79d1a5d8bf537285e4c61efd77558dc4f5f8798d
Donald Carr 9 years ago
parent
commit
63bc3b9fb5
1 changed files with 13 additions and 8 deletions
  1. 13 8
      main.cpp

+ 13 - 8
main.cpp

@@ -22,19 +22,24 @@ int main(int argc, char *argv[])
 {
 {
     qsrand(time(NULL));
     qsrand(time(NULL));
 
 
-    QSurfaceFormat format = QSurfaceFormat::defaultFormat();
-    format.setAlphaBufferSize(8);
-    format.setRedBufferSize(8);
-    format.setGreenBufferSize(8);
-    format.setBlueBufferSize(8);
-    format.setSwapBehavior(QSurfaceFormat::SingleBuffer);
-    QSurfaceFormat::setDefaultFormat(format);
-
     QGuiApplication app(argc, argv);
     QGuiApplication app(argc, argv);
 
 
     app.setOrganizationName("Chaos Reins");
     app.setOrganizationName("Chaos Reins");
     app.setApplicationName("Articulate");
     app.setApplicationName("Articulate");
 
 
+    QSettings settings;
+
+    if (settings.value("force32bpp", false).toBool()) {
+        QSurfaceFormat format = QSurfaceFormat::defaultFormat();
+        format.setAlphaBufferSize(8);
+        format.setRedBufferSize(8);
+        format.setGreenBufferSize(8);
+        format.setBlueBufferSize(8);
+        if (settings.value("forceSingleBuffer", false).toBool())
+          format.setSwapBehavior(QSurfaceFormat::SingleBuffer);
+        QSurfaceFormat::setDefaultFormat(format);
+    }
+
     QQmlApplicationEngine engine;
     QQmlApplicationEngine engine;
 
 
     QThread scanningThread;
     QThread scanningThread;