场景图 - QML 下的 Direct3D 11

演示如何在Qt Quick 场景下直接使用 Direct3D 11 进行渲染。

Direct3D 11 Under QML 示例展示了应用程序如何利用QQuickWindow::beforeRendering() 信号在Qt Quick 场景下绘制自定义 D3D11 内容。该信号在场景图开始渲染之前的每一帧开始时发出,因此响应该信号的任何 D3D11 绘制调用都将堆叠到Qt Quick 项下。

作为替代方案,希望在Qt Quick 场景之上渲染 D3D11 内容的应用程序可以通过连接QQuickWindow::afterRendering() 信号来实现。

在这个示例中,我们还将看到如何让 QML 暴露的值影响 D3D11 渲染。我们使用 QML 文件中的NumberAnimation 来动画阈值,绘制松鼠的 HLSL 着色程序会使用该值。

该示例在大多数方面与OpenGL Under QMLMetal Under QMLVulkan Under QML示例相同,都是通过不同的本地 API 渲染相同的自定义内容。

示例项目 @ code.qt.io

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.