Open Source (MIT Licensed), cross platform C++ library providing integration of VulkanSceneGraph with Qt windowing. Supports Windows, Linux and macOS.
vsgQt6 provides full Vulkan support through the VulkanSceneGraph's built in VkSurface support rather than the limited Vulkan support that Qt-5.10 or later provide. Using the VulkanSceneGraph for providing Vulkan support avoids the restriction that Qt's VulkanWindow has with not being able to share VkDevice between windows, and provides compatibility with Qt versions prior to it adding Vulkan support. Sharing vsg::Device/VkDevice between widgets is crucial for providing multiple 3D viewport widgets without blowing up GPU memory usage.
vsgQt6 provides native Qt integration through the use of a QQuickWidget or QQuickWindow. It does this in the follow manner:
- Set the QQuickWindow graphics API to Vulkan with
QQuickWindow::setGraphicsApi
- Create a Qt graphics device from our vkDevice with
QQuickGraphicsDevice::fromDeviceObjects
- Set the QQuickWindow graphics device with the above created graphics device
- Subclass
QQuickWidget
and have it create aQSGTexture
that in-turn delivers aQRhiTexture
. The underlying texture buffer can be accessed withQRhiTexture::nativeTexture()
- VSG renders into the above buffer
- The
QQuickWidget
renders a scene with a singleQSGSimpleTextureNode
, which ultimately renders theQSGTexture
that is "shared" with VSG - There are various events that can be used to integrate the render loop, such as
QQuickItem::updatePaintNode
orQQuickWindow::beforeRendering
git clone https://github.com/vsg-dev/vsgQt6.git
- VulkanSDK version 1.1.70 or later
- VulkanSceneGraph master, 1.0.8 or later.
- CMake version 3.10 or later
- Qt version 6 or later
- C++17 capable compiler
cd vsgQt6
mkdir build && cd build
cmake ..
cmake --build . -j8
./bin/vsgqtviewer <3D MODEL FILEPATH>
./bin/vsgqtmultiviewer <3D MODEL FILEPATH>
./bin/vsgqtwindows <3D MODEL FILEPATH>
- vsgqtviewer - example of single QApplication/QMainWindow usage with single vsgQt6::Viewer.
- vsgqtmultiviewer - example of QWindow usage with multiple vsgQt6::Viewer in the same QWindow.
- vsgqtwindows - example of multiple vsgQt6::Viewer per QWindow.