Hello Vulkan 小工具示例

展示了QVulkanWindowQWidget 应用程序中的用法。

Hello Vulkan Widget 示例hellovulkantriangle的一个变体,它使用QWidget::createWindowContainer() 将QVulkanWindow 嵌入到基于QWidget 的用户界面中。

设置 Vulkan 管道和渲染三角形的代码与hellovulkantriangle 相同。此外,本示例还演示了QVulkanWindow 的另一项功能:将图像内容从色彩缓冲区读回QImage 。点击 "抓取"(Grab)按钮后,示例将渲染下一帧,然后进行传输操作,以便将交换链色彩缓冲区的内容复制到主机可访问内存中。然后通过QImage::save() 将图像保存到磁盘。

运行示例

运行示例 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.