Replies: 7 comments 2 replies
-
This could potentially be a regression from the recent switch to using dynamic viewports by default. I can't reproduce it on my machine with any of the vsgQt examples or vsgQt-based apps that I've got access to, though, so we're going to need more information here to isolate what's unique to your app. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Does this issue exist if you just load your models into vsgviewer example? Does this issue exist if you just load your models into vsgqtviewer example? Which version of the VSG and vsgQt are you building against? The update of the FOV is done within the WindowResizeHandler::::apply(vsg::View& view) method: https://github.com/vsg-dev/VulkanSceneGraph/blob/master/src/vsg/app/WindowResizeHandler.cpp#l165 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
We'll the logic for handling this isn't in my Application, it's buried in the VSG and vsgQt libraries. I'd rather not go back to those libraries and recompile them with temporary additional logging that I'll have to remove later. It took me a long time to get VSG prerequisites working, vsgQT compile, the vsg Examples compiled, etc. I can though set break points in the WindowResizeHandler and check some of the logic, and values, but I'm not sure if I'll spot where the FOV horizontal is recomputed to compensate for the resize. I'll give it a shot. |
Beta Was this translation helpful? Give feedback.
-
Ok, I may have some idea of what is happening. To be clear, my situation is a bit different from most. I assume the majority are using the full window/screen vsg::Viewer like in the many examples. Much fewer are using a full window/screen Qt widget parent as in the Qt widget examples. But I'm not. I'm using a complex Qt form with a menu, other controls, a status bar, and a place for the vsg window widget. The problem is it's hard to compute the initial size ahead of time for the vsg window because things happen before it comes up. So, I use the rough numbers provided in the Qt designer to pass into the window traits, but even then, bad things happen. I can for example even say I want the central widget geometry at 0, 0, 100, 100 but that should still be BELOW the menu like it would be for most Qt applications. My understanding is that Qt forms with GL accelerated windows can sometimes overlap the menu bar so you need to add a content margin at the top of the layout to "push" the window down. Anyway, all that being said, I can't compute the window size ahead of time, only know that it will receive the window resize events just fine - I can see them coming in perfectly with the VSG resize handler. The problem is with the perspective matrix transform. It computes the aspect ratio NOT from the new size of the window, but as a change from the previous aspect ratio. I'm sure there is a reason for this. Anyway, so if the aspect ratio is wrong to begin with, it will not fix itself when the window is resized and the new width/height/aspect ratio are known. It usually just gets worse. So, what I did is to make a duplicate version of the perspective matrix but change the transform so the aspect ratio is simply computed on the NEW sizing information, alone and not as a change from the old. This seems to work just fine. I'll be testing more soon. But I wanted to leave this note here now because I will not be able to work on this next week. |
Beta Was this translation helpful? Give feedback.
-
Well done on getting to the bottom of the issue. When I wrote the VSG's projection resize mechanism I did it on the assumption that the initial values were valid and changing relative to this would be appropriate. It might be that we can tweak the design so that it handles you particular usage case correctly - the obvious thing to do is have a fixed vertical FOV and then compute the horizontal FOV for the current aspect ratio, but this is vsg::Projection subclass dependent but perhaps it's OK to have individual implementations. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
My first VSG application is coming along. It's a combination of the vsgQt Viewer example, the vsgExamples vsgshadow example, and much more. In general, most things are working. One thing that hasn't been quite right for as long as i can remember is the way in which the scene adapts as the viewer is widened. In the vsgshadows example, I can widen the view as wide as I want, and the shapes are not distorted. In mine, the wider I make the viewer, the more narrow the objects. I have looked almost everywhere I can think of. I can't pin down the exact logic within the VSG framework that keeps the view consitent. I have the same 30 degree vertical perspective matrix setup as the examples. I'm using a combined initialization that is mostly pulled from these two example applications. The window definitely resizes just fine as I pull the Qt viewer's QMainWindow edge. It's definitely making it to things like the "WindowResizeHandler" visitor. Any ideas why my application doesn't keep the view of objects looking normal but the vsgshadows example does?
Beta Was this translation helpful? Give feedback.
All reactions