Sim*_*rta 6 windows opengl qt qtquick2 qt5.6
在 QML 应用程序中,有 3 种渲染类型:
我们使用支持类型的自动加载机制。
如何以编程方式确定在运行时使用哪种渲染类型?
我知道QT_LOGGING_RULES=qt.qpa.gl=true但这会产生大量噪音和调试消息,这些消息不会记录在我们的发布版本中。还有另一种简单的方法来获取渲染类型吗?
感谢@peppe 和一些额外的研究:
// this connection must be established before show() is called
QObject::connect(window, &QQuickWindow::sceneGraphInitialized,
                 [=] () -> void {
    auto context = window->openglContext();
    auto functions = context->functions();
    const std::string vendor = reinterpret_cast<const char*>(functions->glGetString(GL_VENDOR));
    const std::string renderer = reinterpret_cast<const char*>(functions->glGetString(GL_RENDERER));
    const std::string version = reinterpret_cast<const char*>(functions->glGetString(GL_VERSION));
    qDebug() << "OpenGL vendor: " << vendor << " "
             << "renderer: " << renderer << " "
             << "version: " << version;
});
window我的主要 QQuickWindow* 在哪里。