Hello Vulkan 立方体示例

展示了使用QVulkanWindow 的基础知识。

Hello Vulkan Cubes 示例展示了QVulkanWindow 的更高级用法。

在这个示例中,从文件中加载了一个网格、两种不同的材质和相应的图形管道。圆形立方体是使用实例化绘制的,并采用了带有单向光的 Phong 照明模型。

与 hellovulkantexture 和 hellovulkantriangle 不同,这里的统一缓冲区处理采用了另一种方法:使用动态统一缓冲区代替多个描述符集。

该示例需要 QtConcurrent,因为它演示了 QtConcurrent::run() 、QFutureQFutureWatcherQVulkanWindow 结合使用的简单用法。网格和着色器数据加载、潜在昂贵的图形管道构建以及帧命令缓冲区的构建都是在单独的工作线程中完成的。

场景嵌入到基于 widget 的用户界面中。QVulkanWindow 子类还能处理鼠标和键盘输入,因为它提供了第一人称风格的摄像头,以便在场景中移动。

运行示例

要从 Qt Creator,打开Welcome 模式,然后从Examples 中选择示例。更多信息,请参阅Qt Creator: 教程:构建并运行

示例项目 @ 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.