We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm seeing a scaling discrepancy between the default graphics context and a second context of the same size created with the "createGraphics()" function. I have a demonstration of the bug(?) up on OpenProcessing: createGraphics
Might be an issue with my hardware since I'm using a surface pro 4 which has a high density display. If that's the case, is there a way to fix it? Thought it might be "devicePixelScaling()", but that's not available in p5js. Are people with regular density displays seeing the same behavior, or does it seem to work fine for you?
Thanks,
Albert
Answers
Found a computer with ordinary density display and the discrepancy is not there, so it's definitely related to the high density display on the surface pro 4. Is there a fix for this so that I don't have to worry about what kind of display the user might be using?
http://p5js.org/reference/#/p5/pixelDensity
http://p5js.org/reference/#/p5/displayDensity
I found these, but they don't seem to fix the problem. Maybe I'm using them incorrectly. I'll keep experimenting and let the thread know if I resolve it. Thanks.
I don't have the so-called "retina" display hardware, so I can't do tests by myself. 8-|
But have you tried to call pixelDensity() over your p5.Graphics object? >-)
So, still testing, and about to be afk for a while, but I called displayDensity on the default graphics context and the second one that I created using createGraphics(). Both report "2", whatever that means. Just for the hell of it, I set the pixelDensity of the second graphics context (the one created with createGraphics) to "1" and left the other one alone, and that makes the coordinate systems line up.
I don't know why these numbers are what they are, or why setting the pixelDensity to "1" on the second graphics context resolves the issue. I also am not sure what this will do on a normal density display. More to come... Thanks again.
If displayDensity() returns
1
, it means we don't have any sorta hi-res display AFAIK. L-)Good news. Setting pixelDensity to "1" on the second graphics context seems to work fine on both hi-res and ordinary displays.