vsgQt refactor to support multiple windows & assocaited updates to VSG and vsgExamples #862
Replies: 6 comments 7 replies
-
hello To add models from the disk when clicking a button in the interface, it seems that the initializeCallback function is executed every time a model is loaded. Is this the correct approach? |
Beta Was this translation helpful? Give feedback.
-
I have made modifications to your vsgQtViewer and would like to implement the functionality of dynamically loading models. I would like to confirm whether this framework supports such dynamic loading. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much. I have resolved my issue. |
Beta Was this translation helpful? Give feedback.
-
"I'm sorry for the trouble I caused you. I apologize sincerely." |
Beta Was this translation helpful? Give feedback.
-
Hi All,
I have been working on vsgQt to enable support for multiple windows including within QMdiArea, to achieve this I have had to refactor the vsgQt backend, and also had to make some updates to the core VSG's vsg::WindowTraits to make this possible, so both the VSG and vsgExamples repos have been updated.
The changes to VSG are to add a Viewer::removeWindow(..) method and replace the vsg::WindowTraits::shareWindow with vsg::WindowTraits:device which are now merged with VSG master, the changes are:
VulkanSceneGraph changes
I also had to update a couple of examples in vsgExamples replacing the WindowTraits::shareWindow usage with WindowTraits::device, these changes may be what you'll need to apply to your own applications if you have been using this feature:
vsgExample changes
The big changes are to vsgQt, in terms of public interface vsgQt::ViewerWindow has been renamed vsgQt::Window, but for now you can still use vsgQt::ViewerWindow naming as I've added a using ViewerWindow = vsgQt::Window. The public API of vsgQt::Window is mostly unchanged but the back-end has substantially changed. Finally there are two new examples - vsgqtmdi and vsgqtwindows that illustrate multi-document area with multiple sub windows, and multiple separate windows respectively. The changes are:
vsgQt changes
The backend to vsgQt::Window has been completely rewritten, dropping the native Qt Vulkan Surface/Swapchain support entirely and falling back to using the VSG's Vulkan Surface./Swapchain support. I had to make this change as I could find a way to shared vkDevice between QWindow as Qt has chosen to "simplify" their Vulkan support by tying vkDevice per QWindow. I could find way around this for Qt5 or Qt6, it's a really bone headed design decision from Trolltech as it severally hobbles Qt applications wanting to leverage all of Vulkan capabilities.
This Qt design decision is not an issue for simple applications with a single Vulkan graphics window, but for multiple Windows it forces one to have multiple logical vkDevice and with it forces users to duplicate data between Windows. As the VSG is designed to scale properly without such restrictions it was a show stopper so I had no choice but to drop use of Qt's native Vulkan support and use the VSG itself to provide this, with Qt just providing the basic Windowing support.
I have only tested under Linux so far. The code paths look like they should work under Windows, but I don't think the VSG's macOS support doesn't yet support it so will need to be implemented. Under Windows we'll need to do some testing and debug if necessary. I have family time lined up tomorrow through to next Tuesday so will look to get a Windows build next week if no one else gets to it first.
The nice thing about using the VSG backend is that all the WindowTraits settings that can be used with native VSG windowing works now with vsgQt::Window, so enabling MSAA, depth/image formats, Vulkan features etc. all work in the same way as you'll see in the vsgExamples programs demo'ing various features.
I have created two new vsgQt examples, the first vsgqtwindows works a bit like vsgwindows example creating multiple windows, each can have their own model or share as we see in this screenshot (note 8 sample MSAA is enabled with the --samples 8):
vsgqtwindows models/teapot.vsgt --samples 8
The second new example is vsgqtmdi with demonstrates use of QMdiArea to manage multiple sub windows:
$ vsgqtmdi models/openstreetmap.vsgt
All this code is hot off the presses and needs community testing of VSG, vsgQt and vsgExamples master. Once it looks like things are working well across platforms I'll tag point releases for each of these projects. Let me know of success/failures on this thread.
Beta Was this translation helpful? Give feedback.
All reactions