From 0df69773376a0489288a938d485c75c49cc4de09 Mon Sep 17 00:00:00 2001 From: Tomi Korpipaa Date: Fri, 29 Mar 2019 08:55:11 +0200 Subject: Fix surface format bug for macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QT3DS-3238 Change-Id: Ie3a675ef32251481abaa460bb89bc1c4381573ea Reviewed-by: Pasi Keränen Reviewed-by: Ulf Hermann --- tools/qmlscene/main.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'tools/qmlscene/main.cpp') diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index c1399c38e5..8b1a679183 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -612,6 +612,19 @@ int main(int argc, char ** argv) fprintf(stderr, "%s\n", qPrintable(component->errorString())); return -1; } + + // Set default surface format before creating the window + QSurfaceFormat surfaceFormat; + if (options.multisample) + surfaceFormat.setSamples(16); + if (options.transparent) + surfaceFormat.setAlphaBufferSize(8); + if (options.coreProfile) { + surfaceFormat.setVersion(4, 1); + surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); + } + QSurfaceFormat::setDefaultFormat(surfaceFormat); + QScopedPointer window(qobject_cast(topLevel)); if (window) { engine.setIncubationController(window->incubationController()); @@ -635,19 +648,11 @@ int main(int argc, char ** argv) if (options.verbose) new DiagnosticGlContextCreationListener(window.data()); #endif - QSurfaceFormat surfaceFormat = window->requestedFormat(); - if (options.multisample) - surfaceFormat.setSamples(16); if (options.transparent) { - surfaceFormat.setAlphaBufferSize(8); window->setClearBeforeRendering(true); window->setColor(QColor(Qt::transparent)); window->setFlags(Qt::FramelessWindowHint); } - if (options.coreProfile) { - surfaceFormat.setVersion(4, 1); - surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); - } window->setFormat(surfaceFormat); if (window->flags() == Qt::Window) // Fix window flags unless set by QML. -- cgit v1.2.3 From 14109aaccc37df53a0c4b591dddd68b41ec20ec3 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 29 Mar 2019 16:53:11 +0100 Subject: add core profile environment variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enables 3druntime scenes at macOS without calling it with extra process arguments. Task-number: QDS-553 Change-Id: I04e59f4f9061eb2a567c65406c5a8195b1896836 Reviewed-by: Tomi Korpipää Reviewed-by: Alessandro Portale --- tools/qmlscene/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools/qmlscene/main.cpp') diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 8b1a679183..83d6ce5d72 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -522,7 +522,8 @@ int main(int argc, char ** argv) options.resizeViewToRootItem = true; else if (lowerArgument == QLatin1String("--multisample")) options.multisample = true; - else if (lowerArgument == QLatin1String("--core-profile")) + else if (lowerArgument == QLatin1String("--core-profile") + || qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE")) options.coreProfile = true; else if (lowerArgument == QLatin1String("--verbose")) options.verbose = true; -- cgit v1.2.3