xxxxxxxxxx
26
function squareCam(){
for(let y=0;y<cam.height;y++) {
// then by column (x)
for(let x=cam.width;x>=0;x--) {
// get the r,g,b of each pixel
let i = (x + y * cam.width) * 4;
let r = cam.pixels[i+0];
let g = cam.pixels[i+1];
let b = cam.pixels[i+2];
// use that color to draw a rect to the screen
let rectY = y*yScale;
noStroke();
fill(r,g,b);
rect((cam.width-x-1)*xScale, rectY,xScale,yScale);
} // end x for()
} // end y for()
}