nature-of-code / noc-book-2

Nature of Code with p5.js and Notion workflow / build system.
https://natureofcode.com
1.06k stars 72 forks source link

Misbehaving Resolution on Wide Monitors #1007

Open osoleve opened 3 weeks ago

osoleve commented 3 weeks ago

Setup: OS: Windows 11 IDE: VSCode + p5.vscode extension (Possibly) relevant hardware: Laptop screen + 2x Dell S3221QS: one landscape, one portrait. Sketch output is on landscape monitor.

Behavior: In Ch. 0, the code for the Perlin Noise pixel map produces an output that occasionally switches to being repeated 4x horizontally, and squished vertically to 25% of its height.

What worked for me: Add pixelDensity(1); to setup().

shiffman commented 3 weeks ago

Could you send a screenshot, I don't have a setup where I can reproduce. I wonder if this is a p5.js or JS/canvas bug rather than an issue with the nature of code examples specifically?

osoleve commented 3 weeks ago

Oh, sorry for not specifying, I very much think this is a bug in the software not the book's code, and that it might just be helpful to add a note about. Screenshots show before/after setting pixelDensity (been messing with the color value calculations and nosieDetail, which is why it looks nothing like the original example, but the issue is similar to the original).

image image