[quote author=extrapixel]
Click to turn smooth on/off:
[/quote]
This works.
However is seems impossible to update the img in the draw() loop.
e.g. this gives a single static noise image, instead of a dyunamic one...
Code:
PImage img[] = {
createImage(80,80, RGB),
createImage(80,80, RGB),
createImage(80,80, RGB),
createImage(80,80, RGB)
};
boolean smoothOn;
void setup() {
size(800,800);
noSmooth();
smoothOn = false;
}
void draw() {
background(0);
for ( int k = 0; k < img.length; k++ ) {
loadPixels();
for(int i=0; i < img[k].pixels.length; i++) {
img[k].pixels[i] = color(random(255), random(255), random(255));
}
updatePixels();
}
scale(2.0);
int k = 0;
for ( int x = 0; x < 2; x++ ) {
for ( int y = 0; y < 2; y++ ) {
image(img[k++],x*80,y*80);
}
}
}
void mousePressed() {
if (smoothOn) {
noSmooth();
smoothOn = false;
println("smooth off");
}
else {
smooth();
smoothOn = true;
println("smooth on");
}
}