Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FX2D renderer behaves inconsistently using surface.setSize(), displayHeight, displayWidth #9

Open
B3ret opened this issue Jul 27, 2018 · 2 comments
Labels
help wanted Many hands make light work. Please help!

Comments

@B3ret
Copy link

B3ret commented Jul 27, 2018

Description

Under the default Renderer, a combination of displayHeight, displayWidth and surface.setSize() can be used to set the window size to a specified portion of the screen size.

Under the FX2D-Renderer, displayHeight and displayWidth report the same values, but surface.setSize() seems to adhere to the Windows scaling factor on HighDPI displays, (similar to all other drawing calls, which seem to not work on screen pixels anymore).

Expected Behavior

surface.setSize() should work on the same pixel metric as displayHeight and displayWidth, or there should be another way to specify the window size as a portion of the screen size.

Current Behavior

There is no way from within processing to achieve a drawing size relative to the current screen size.

Steps to Reproduce

Execute the code below on highDPI Windows with a scaling factor >100%. The drawing height and width will be scaled by the windows scaling factor for FX2D, but not for the default renderer.

void setup()
{
  size(800, 600, FX2D);
  surface.setResizable(true);
}

boolean _isFirstRun = true;

void draw()
{
  if(_isFirstRun)
  {
    _isFirstRun = false;
    setDefaultWindowSize();
  }
  
  textSize(20);
  text("Renderer: " + sketchRenderer(), 10, 20);
  
  text("displayWidth: " + displayWidth, 10, 70);
  text("displayHeight: " + displayHeight, 10, 90);
  text("displayDensity(): " + displayDensity(), 10, 110);
  
  text("width: " + width, 10, 170);
  text("height: " + height, 10, 190);
}

void setDefaultWindowSize() 
{
  surface.setSize(displayWidth / 3, displayHeight / 3);
}

I attached the output for Default/FX2D and scaling factors 100%/150% below.

Your Environment

  • Processing version: .3.7
  • Operating System and OS version: Windows 10, all updates (07/2018)
  • Other information: Bug depends on scaling factor set in Windows. (Note: This is mandatory to be different from 100% on highDPI windows! It's not an edge case!)

Possible Causes / Solutions

displayDensity() could return a float instead of an int and capture this scaling factor as well.
surface.setSizeInScreenPixels() could be introduced.

FX2D, 150% Windows scaling factor (KO):
fx2drenderer_150percent

Default, 150% Windows scaling factor (OK):
defaultrenderer_150percent

Default, 100% Windows scaling factor (OK):
defaultrenderer_100percent

FX2D, 100% Windows scaling factor (OK):
fx2drenderer_100percent

@gohai
Copy link

gohai commented Jul 27, 2018

@B3ret I have yet to use the experimental FX2D renderer myself, but this looks like a thorough report - thanks for including the screenshots!

@benfry benfry transferred this issue from processing/processing Jan 16, 2022
@benfry benfry added the help wanted Many hands make light work. Please help! label Jan 16, 2022
@dgray001
Copy link

Got this issue today only after upgrading to processing 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Many hands make light work. Please help!
Projects
None yet
Development

No branches or pull requests

4 participants