Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat()); crash Studio3D scene loaded with QML



  • I try to load Studio3D scene following qt3d-runtime-requirements (http://doc.qt.io/qt3dstudio/runtime/qt3d-runtime-requirements.html)

    but QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat()); make it crash.

    with my code below, I have to add button to reload the presentation to make it working, otherwise, I have black screen...:

    I try kits QT 5.11.0 32 / MSVC 2015; QT 5.11.0 64 / MSVC 2015; QT 5.11.0 64 / MSVC 2017 same for all of them...

    main.cpp

    #include <QtWidgets/QApplication> // for MessageDialog
    #include <QtQuick/QQuickView>
    #include <q3dsruntimeglobal.h>
    #include <QSurfaceFormat>
    
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        // Use the ideal format (i.e. OpenGL version and profile) recommended by
        // the Qt 3D Studio runtime. Without this the format set on the QQuickView
        // would be used instead.
      //QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat());
    
        QQuickView viewer;
        viewer.setSource(QUrl("qrc:/main.qml"));
        viewer.setTitle(QStringLiteral("Qt 3D Studio Example"));
        viewer.setResizeMode(QQuickView::SizeRootObjectToView);
        viewer.resize(1280, 720);
        viewer.show();
        return app.exec();
    }
    

    main.qml

    import QtQuick 2.0
    import QtStudio3D 2.0
    import QtQuick.Controls 2.2
    
    Rectangle{
        id: root
        color: "lightGray"
    
        Studio3D {
            focus: true
            anchors.margins: 60
            anchors.fill: parent
            Presentation {
                id:s3dpres
                source: "file:///F:/corvette_cluster_2018/corvette_cluster_2018.uip"
                profilingEnabled: true
                profileUiScale: profUiScale.value / 100
    
            }
    
        }
        Button {
            text: "Reload"
            onClicked: s3dpres.reload()
            focusPolicy: Qt.NoFocus
        }
    }
    

    Any idea to help me?



  • Solve with replacing on project environment

    QT_OPENGL desktop in place of angle


Log in to reply