Hi hi, I’m using the webcam on a high dpi tablet, showing the webcam image and overlaying a few rectangles matching the webcam pixel color below.
I based my code on the reference:
// From https://p5js.org/reference/#/p5/get let x, y, d; // set these to the coordinates let off = (y * width + x) * d * 4; let components = [ pixels[off], pixels[off + 1], pixels[off + 2], pixels[off + 3] ]; print(components);
but the rectangle colors seem to be sampling a scaled webcam image. With this change
let off = (y * width * d + x) * d * 4;
it works fine. So I wonder where is the bug: somewhere else in my code? Or should the reference be corrected? ps. I haven’t used high dpi before and my code includes two blur shaders and two Graphics, so the issue may be elsewhere.