-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Labels
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.x.x
Web browser and version
chrome://142.0.7444.135
Operating system
Windows 11 Version 25H2 (Build 26200.7171)
Steps to reproduce this
Actual Behavior
In p5 2.x, if you set pixelDensity(n), although the canvas pixelDensity is changed to n, any p5.Graphics that you create will NOT have density n. you have to call Graphics.pixelDensity(n) to have the same pixelDensity.
https://editor.p5js.org/imrinahru/sketches/ufS-89YGX
ver 2.1.1
After calling pixelDensity(1) , the log shows g.pixelDensity remains 2.
ver.1.11.11
After calling pixelDensity(1) , the log shows g.pixelDensity is set 1.
Expected Behavior
pixelDensity(n) is applied to both the Canvas, and the p5.Graphics that will be created on that Canvas.
Steps to reproduce
Steps:
- Go to any p5 2.x
- createCanvas and call
pixelDensity(n), setnas a different value from what is by default set by your PC resolution to see the difference. createGraphicson the canvas- Check the
pixelDensityof the Graphics byconsole.log(Graphics.pixelDensity()).
Snippet:
function setup() {
createCanvas(400, 400);
pixelDensity(1);
let g =createGraphics(400, 400);
console.log(g.pixelDensity());
}
The issue is related to an issue previously filed in p5.riso library: antiboredom/p5.riso#23