The window size I request is not used; instead, a scaled one is used


#1

Hi. :slight_smile:

I’m doing:

setWindowSize(854, 480);

in setup(). But when I screenshot my app and measure the window in the screenshot, it’s 1068x600px. Coincidentally, that’s exactly how big the youtube player is in a maximized browser window on my PC.

Return values I’m getting:

  • getWindowWidth() -> 854.
  • getWindowContentScale() -> 1
  • isHighDensityDisplayEnabled() -> false

My display resolution is 1920x1080 and I’m on Windows 10.

Any idea what’s going on?


Odd viewport scaling issue on Windows
#2

I just opened the Display settings of Windows and saw an option called “Change the size of text, apps, and other items” which has the value “125%”. This explains it :slight_smile:


#3

Yep, that’s it. I just had this problem a week back. corrected it manually like you did. I’m not sure if there’s a way to escape this magnification from Windows OS though? Does this forcibly affect all the apps in the OS or is there a setting in Windows implementation of the App class that can ignore this programmatically, the problem gets annoying and important when talking of distributing the Cinder based applications.


#4

Make sure you enable “High DPI Aware” in your project manifest. This should take care of most problems related to desktop scaling. See also this old post by Shawn Lipowski.

Look for the setting in your Options window. It may look slightly different, depending on the version of Visual Studio you use.


#5

Thanks Paul for the tip. I had no idea Shawn is also a Cinder user, That’s pretty awesome, Shawn is a brilliant Houdini user and instructor (VEX in Houdini), another feather in Cinder’s hat (and vice versa) IMO :wink:


#6

I know he is brilliant, I’m doing a project with him as we speak and it’s a blast. :slight_smile:


#7

So you’re the guy he mentions in his class when he suggests Cinder for realtime applications and he mentions a co-worker of his who works with Cinder. Connecting the dots now, very very cool indeed :smiley:


#8

This problem should be addressed automatically with the following pull request:
https://github.com/cinder/Cinder/pull/1934

This also provides mechanisms for DPI-awareness if you have cause to use them, but the average Cinder app probably does not, and with this PR the default behavior on recent versions of Windows will avoid pixel-scaling as you were seeing.