High-DPI Support

News and discussion of the PC port of Oolite.

Moderators: another_commander, winston

Post Reply
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6552
Joined: Wed Feb 28, 2007 7:54 am

High-DPI Support

Post by another_commander »

With the advent of high resolution 4K screens, applications have now the possibility to display crystal-clear, crisp, high detail and quality images. This is the good news.

The bad news is that not all applications are really ready for this. Older protgrams, written before the high-rez era, show their window and UI contents as minuscule graphics, sometimes very difficult to work with when subjected to anything above 1920x1080. Modern OSs are taking care of this by providing user selectable higher screen DPI settings, that applications can make use of, in order to maintain their high quality of display, but also provide an interface that still remains legible and clear even at extremely high screen resolutions. For those interested, this is a quite nice intro: https://software.intel.com/en-us/blogs/ ... ing-issues.

When an application is run under high-DPI settings, Windows Vista and later will try to help it display better by rescaling its main window and interface by means of the so-called DPI Virtualization. However, rescaling the entire application like this, when the application was not designed with such rescaling in mind, can often lead to problems. Newer applications have ways of telling Windows not to do that, beacuse for example, the protgammers have already taken into account high-DPIness and are handling it within the application itself.

So, older apps written before high-DPI was a thing may have issues with DPI virtualization. Another class of applications very prone to issues is games. Those handle their window positions, resolutions and displays almost always internally and therefore tend to interfere with Windows DPI virtualization, activated when the OS sees that the game tries to run under a non-default DPI setting.

Oolite is one of those games hit by this. When you set the Windows scaling factor to anything above 120%, DPI Virtualization will kick in. Running Oolite 1.84 or earlier under such conditions will subject the game to undesired window rescaling. You will notice the following:
- Splash screen appears bigger than normal
- Game window appears much bigger than normal, part of it may render out of screen
- Going full screen has all sorts of weird side-effects, from inability to switch altogether, to unexpected window behaviour that may also depend on the gfx drivers, like failing to resize etc. Most importantly, when on multiple monitors, going fullscreen will cause the full screen window to cross-over to the other monitor. We've already had bug reports about this (see github issue 226), which we attributed to driver issues at that time. Now I'm 99% sure that DPI rescaling was involved.

This weird situation has now been fixed in trunk. Oolite now declares itself DPI-aware on startup, effectively telling the operating system "Look, I can handle my own display very nicely thankyouverymuch, now hands off my window, kthxbye". This solves the problem for 1.85 onwards. To fix 1.84 and earlier, there are two possible ways you can try, both very easy and simple:

1. Right-click on the oolite.exe file, select Properties and then, inside the Compatibility tab, check the box labeled "Disable Display Scaling On High DPI Settings", click OK and you're done. See image below for illustration.
Image


2. Paste the below text into a text file and save it inside the oolite.app folder (where the oolite.exe also resides) with the filename oolite.exe.manifest. When you launch the game again, DPI virtualization will be disabled and everything should look and act normal.

Code: Select all

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
      <dpiAware>true</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>
Note that this will probably not resolve the problem in the multiple monitors case, but should do for signle monitor.


Edit: And this should hopefully work for both single and multi monitor cases:

Code: Select all

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
      <dpiAware>true/PM</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16059
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: High-DPI Support

Post by Cody »

another_commander wrote: Wed Jun 14, 2017 6:18 pm
... sometimes very difficult to work with when subjected to anything above 1920x1080.
There's me, soon to upgrade to a 1920x1080 monitor. But that's old hat now - like me.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Re: High-DPI Support

Post by pagroove »

Yes. I was about to ask for 4k support. So this is nice because I have bought a new machine with a 4k monitor. :)
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
Post Reply