Mobile performance different between "present" and "full screen"

Hi,
I made a checkers game in p5 and it is working well, but I noticed a really strange behavior when using the share links. When I use “full screen” in my mobile (or mobile emulation with inspect mode in chrome) I get the normal behavior and everything works smoothly. However, when I use the “present” mode, the selection of the pieces is much more sluggish.

Full Screen mode:
https://editor.p5js.org/Miguelac/full/r4bnJ6j-Y

Present mode:
https://preview.p5js.org/Miguelac/present/r4bnJ6j-Y

Any Idea why this would be? My only guess is that there is something wrong with the way I coded the touch selection, but I can’t seem to see what.

1 Like

Same thing happens with another project.

Full (all ok):
https://editor.p5js.org/Miguelac/full/r2awDBUN0

Present (very slow):
https://preview.p5js.org/Miguelac/present/r2awDBUN0

Is this normal? Seems super strange to me to be honest.

I can’t replicate this in my (old) laptop with an up-to-date Chrome browser – when I interact at the two links above, both seem equally snappy. Can you add timing debug information? Something device-specific, maybe to Android?

I think I figured out the issue.
It seems to be related to resolution. Basically the source-code of “full” sets a viewport but “present” doesn’t. To fix this I added:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

just below the <head>

Without this it seems p5 ignores the pixel density and renders for the full screen resolution.

1 Like