This code is supposed to step through the x and y coordinates of a picture, fifty pixels at a time, and draw a box of random size at these locations. Can't get it to work. Can't see what's wrong.
size (4000, 2000);
loadPixels();
int step = 50;
for (int x = step; x == (width - step); x = x + step)
{
for (int y = step; y == (height - step); y = y + step)
{
int boxx = int(random(step));
int boxy = int(random(step));
color c = color(random(255), random(255), random(255), random(100));
//print (c + " ");
int pix = y * width + x;
for (int p = 0; p < boxx; p++)
{
pix = pix + p;
for (int q = 0; q < boxy; q++)
{
pix = pix + q * width;
pixels[pix] = color (c);
}
}
}
}
updatePixels();
The following code is supposed to give me a window of red, green and blue pixels but it just gives a white picture. What am I doing wrong? Changing the size gives all blue, or green and blue but no red. When the 'print' line is enabled it gives a series of random 0's, 1's and 2's so that's working properly.
size(40, 20);
loadPixels();
float rand = random(3);
int j = 0;
for (int i = 0; i < pixels.length; i++) {
rand = random(3);
j = int(rand);
//print (j);
if (j == 0);
{
pixels[i] = color (255, 0, 0);
}
if (j == 1);
{
pixels[i] = color (0, 255, 0);
}
if (j == 2); {
pixels[i] = color (0, 0, 255);
}
}
Just downloaded Processing again after an absence of several months. Clicked on Examples in the File Menu. Nothing. However, I do get a double tab on the taskbar. The first one is for the current sketch, the next seems to contain a list of examples. Trouble is when you click on it it doesn't come up. Heads need to roll. Couldn't find anything about this on the forum. Grrrrrr!
Bollocks, just found out why since putting this post up. It was because I opened the Processing window full size. The Examples opened in a separate window which was off screen. Grrrrr.
So, how can I set the Processing window to be full size automatically everytime I open it? How can I ensure that the off-screen windows are visible? Grrrrr! Heads need to roll!
And another thing: Why do we have a choice of two back links and the IE back arrow every time we want to travel backwards in the forum. One of these always works but you never know which one. Grrrr, someone is deliberately winding us up.
I've just downloaded Processing and started the tutorials. I'm a complete beginner and anyone answering my plea will have to be very explicit when explaining things to me. No, I don't mean slagging me off!
On trying to run an application that has previously been exported to application I get an error message to the effect that Windows can't find javaw.exe. I looked this problem up on the old forum and found a thread. But, can I understand it. No way.
I'm hoping someone will be kind enough to explain to a complete novice how to get round this problem. Thanks.