gwen-nolegacy-opentk-renderer icon indicating copy to clipboard operation
gwen-nolegacy-opentk-renderer copied to clipboard

Scaling Issue on High DPI displays

Open michidk opened this issue 8 years ago • 5 comments

Hey, I found this project a few weeks ago, and it worked fine so far on my workstation at home. But currently I'm using my laptop (Surface Pro 4) which has a 2K display.

While the same build works fine on my desktop at home, on my laptop it looks like this: http://img03.imgland.net/MxhhFBy.png

The font size is too big and the elements are unclickable (it seems like the mouse position is transformed wrongly).

I tried changing the canvas.Size to 0.5f, but it seems to change the position of the UI, so that the UI elements are invisible.

michidk avatar Aug 31 '16 19:08 michidk

Just noticed, that my project is using the VBO implementatiom by HappyEmu.. gonna report that issue there, first.

michidk avatar Aug 31 '16 19:08 michidk

No worries. It sounds like whole application is being scaled on the high DPI display, have you disabled high DPI scaling for the project?

The canvas.Size property will change the actual size of the canvas in pixels, not scale the whole interface.

opcon avatar Aug 31 '16 23:08 opcon

have you disabled high DPI scaling for the project?

How do I changed the high DPI scaling of my OpenGL application?

The canvas.Size property will change the actual size of the canvas in pixels, not scale the whole interface.

So is there another way to scale the UI manually?

Another thing I tried: Changing the zoom factor in the displays settings just makes the window smaller, but the UI is still "zoomed" and non-intractable. (http://img04.imgland.net/-kVEVoS.png)

michidk avatar Sep 02 '16 23:09 michidk

To make your C#/Visual Basic application DPI aware, you need to add a custom application manifest.

  • Right-click on your project file in the Solution Explorer and click Add New Item
  • Choose Application Manifest File from the options that appear
  • Open that file and uncomment the DPI block:
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    </windowsSettings>
  </application
  • Use the custom manifest in your project by going to the project properties, the under the Application tab change the Manifest drop-down in the resources section to your newly created manifest file.

I can't think of a way to scale the UI manually, perhaps that's something I can add in a later release

opcon avatar Sep 03 '16 09:09 opcon

I followed your steps, but sadly it did not fix the Issue. The only thing this changed was that my console window is now on a different location. (I used to change its default position, so that I was able to see the console log and the game window at the same time.)

Edit: It seems like that only my "Program" is DPI aware but not OpenTK / OpenGL. Because my OpenTK window is initialized with a size of (1280, 720) and is nearly fullscreen. If I now initialize the console window with the same size, its much smaller (nearly half the size). My screen has a resolution of 2736x1842.

michidk avatar Sep 03 '16 15:09 michidk