diff --git a/CMakeLists.txt b/CMakeLists.txt index 46a5ac6b90..bbec4a0884 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,17 +41,22 @@ else() option(BUILD_TESTS "Build tests" ON) endif() -option(DISABLE_QML "Disable QML" OFF) +if (ANDROID) + option(USE_GLES "Use OpenGL ES" ON) + set(PLATFORM_QT_COMPONENTS AndroidExtras WebView) +else () + option(USE_GLES "Use OpenGL ES" OFF) + set(PLATFORM_QT_COMPONENTS WebEngine WebEngineWidgets) +endif () + +if (USE_GLES AND (NOT ANDROID)) + option(DISABLE_QML "Disable QML" ON) +else() + option(DISABLE_QML "Disable QML" OFF) +endif() option(DISABLE_KTX_CACHE "Disable KTX Cache" OFF) -if (ANDROID) - option(USE_GLES "Use OpenGL ES" ON) - set(PLATFORM_QT_COMPONENTS AndroidExtras WebView) -else () - option(USE_GLES "Use OpenGL ES" OFF) - set(PLATFORM_QT_COMPONENTS WebEngine WebEngineWidgets) -endif () set(PLATFORM_QT_GL OpenGL) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d5c02ae1c8..0271b2cc5f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -766,8 +766,10 @@ OverlayID _keyboardFocusHighlightID{ UNKNOWN_OVERLAY_ID }; // // So instead we create a new offscreen context to share with the QGLWidget, // and manually set THAT to be the shared context for the Chromium helper +#if !defined(DISABLE_QML) OffscreenGLCanvas* _chromiumShareContext { nullptr }; Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); +#endif Setting::Handle sessionRunTime{ "sessionRunTime", 0 }; @@ -2225,6 +2227,8 @@ void Application::initializeGL() { } _glWidget->makeCurrent(); + +#if !defined(DISABLE_QML) if (!nsightActive()) { _chromiumShareContext = new OffscreenGLCanvas(); _chromiumShareContext->setObjectName("ChromiumShareContext"); @@ -2232,6 +2236,7 @@ void Application::initializeGL() { _chromiumShareContext->makeCurrent(); qt_gl_set_global_share_context(_chromiumShareContext->getContext()); } +#endif _glWidget->makeCurrent(); gpu::Context::init(); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 98a8d10f28..80ec78f118 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -52,6 +52,14 @@ int main(int argc, const char* argv[]) { QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar); #endif +#if defined(USE_GLES) && defined(Q_OS_WIN) + // When using GLES on Windows, we can't create normal GL context in Qt, so + // we force Qt to use angle. This will cause the QML to be unable to be used + // in the output window, so QML should be disabled. + qputenv("QT_ANGLE_PLATFORM", "d3d11"); + QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); +#endif + disableQtBearerPoll(); // Fixes wifi ping spikes QElapsedTimer startupTime;