As PhiLho just said, you have to understand the draw principle on which Processing is based.
The draw function will be executed at each frame wihch means at teh frequency set by frameRate() method.
If you do a FOR or WHILE loop inside the draw, this loop will be entirely executed at each frame which means your picture will be drawn entirely at each frame.
To test the idea put a background(0); before your loop.
See, doesn't change anything because the all picture is drawn by the loop on the background.
What you want is draw ONE pixel at each frame not the all picture so that you can see the progression of the drawing process.
An other way to do it for illustration purpose would be to write a method draw_next_pixel which will draw the next pixel of your picture. Then you call that method in the draw :
Code:
int xPixel=0;
int yPixel=0;
void setup()
{
size(300,300);
frameRate(1000);
}
void draw()
{
drawNextPixel();
}
void drawNextPixel()
{
//color the current pixel
color c = color(255-yPixel, 255-xPixel, 0);
set(xPixel, yPixel, c);
// define next pixel
if(yPixel<height)
//next line
yPixel++;
else
{
// back to first line
yPixel=0;
if(xPixel<width)
// next column
xPixel++;
else
{ //end of the picture >> erase and do again
xPixel=0;
background(0);
}
}
}
Got it ?