Replies: 3 comments 2 replies
-
So far I have only done Viewport resizes in the context of window resizing. I have not yet written a testbed/example that does independent resizing of ViewportState. The Camera's ViewportState is what controls what is rendered, but in Vulkan one also has to update the GraphicsPipeline objects in the scene to reflect this value. The WindowResizeHandler passes on updates to viewport dimensions. It might be this this is usable as is, or it might be that we need to expose the viewport size capability in a more friendly way. The viewDependentState tracks the viewport state in a way that can be accessed from sharers rather than defines it you should be able to safely ignore settings this. |
Beta Was this translation helpful? Give feedback.
-
Today I did some work for a client that wanted to swap two Views, to test this out I modified the vsgmultiviews example so that the insert view would be swapped with the main view when you press 's', then set about getting it to work. I found I could easily just reuse the WindowResizeHandler so I created a new UpdateGraphicsPiplines utility class that works on similar lines, but is a bit more general, this is now checked in VSG master: The key part of the update vsgmultiviews example is in the ViewHandler: https://github.com/vsg-dev/vsgExamples/blob/master/examples/app/vsgmultiviews/vsgmultiviews.cpp#L39 The code has to fine the vsg::Views assigned to the vsg::RenderGraph then swap the first two of them so that the insert view now becomes the first rendered, then the original first map view becomes the second one rendered. The next change to them is to swap the two View's Camera's ViewportState objects so they then have the others viewport/scissor settings, then finally we run the vsg::UpdateGraphicsPipeline. The code looks like:
For the case of just changing the ViewportState of a single View it should be possible to just update the View's ViewportState then run the UpdateGraphicsPipeline to rebuild the graphics pipelines in the scene graph. I hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Thanks Robert. This does help :)
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to alter a camera's viewport at runtime. Before compile I set:
And some of the thing I've tried are:
Beta Was this translation helpful? Give feedback.
All reactions