Issues with pixel array and Retina? (Forcing pixelDensity?)

edited December 2014 in p5.js

Hey guys. I'm trying to set up a new sketch using P5.js. I was messing around with the set() function and realized that for whatever reason it will only let me access the top left fourth of the canvas.

The code looks like this:

set(150, 150, black);
ellipse(150, 150, 50, 50);
stroke(255, 0, 0);
ellipse(75, 75, 25, 25);

(on a 300x300 canvas)

And that makes this:


The black ellipse is around where I thought the pixel would show up, and the red ellipse is centered on where it actually showed up.

What's going on with this? I remember reading in the reference that the pixel array in P5.js is actually 4 times as many values as there are pixels since the color data is being stored sequentially, does that affect this somehow?

ETA: Also potentially of note, I'm on a Retina MBP, if that makes any difference.

ETA 2: I found on github a mention of this issue. It says to "force _pixelDensity = 1", anybody know how to do that?



Sign In or Register to comment.