Handling DPI Awareness on Windows #694
Replies: 1 comment
-
I have changed the title to some more appropriate for discussion, and moved this from Issue to Discussion as it's not a bug, just a topic for discussion. Vullkan itself works just in native hardware pixel sizes and doesn't have a concept of "DPI" that Windowing system might apply on top. The VulkanSceneGraph is a "Vulkan" scene graph so takes it's cues from Vulkan w.r.t conventions and while it has some minimal Windowing supported for the purpose of opening a graphics window isn't a Windowing toolkit. Whether the DPI/scaling options that a Windowing system/toolkit might offer should be controllable from the VSG side is possibly something we could debate, this would only be as far as creation of the window, so affect WindowTraits hints and how it's handling by the Win32/Xcb/MacOS etc. implementations. Once the Window is created, and all events that are handled will need to be in hardware pixel coordinates not some high level scaling that the Windowing system applies because some applications aren't aware of the appropriate size to create a window on a system. I recently had problems with vsgQt as it was applying it's Qt's devicePixelRatio causing a mismatch between the window dimensions it was saying it was creating, and what the underlying window and hence Vulkan swap chain was creating. This scaling is now handled in vsgQt so it doesn't pollute the underlying Vulkan/VSG side with this scaling kludge. I mention this in the thread #687. |
Beta Was this translation helpful? Give feedback.
-
before create win32 window, tell system not to automatically scale. I copy source code from vulkan-example here:
Beta Was this translation helpful? Give feedback.
All reactions