Actually still not working.
This is what I got so far::
PGraphics pg;
float col=10;
int count=0;
int xsize=1500;
int ysize=500;
int tempx;
int tempy;
int temppixel;
int px;
int py;
float pixheight;
int pixel;
void setup(){
size(1500, 500);
noSmooth();
colorMode(RGB,255);
pg=createGraphics(xsize, ysize);
pg.colorMode(RGB,255);
pg.noSmooth();
pg.beginDraw();
pg.background(0,0,0);
pg.loadPixels();
pg.fill(255);
pg.strokeCap(SQUARE);
frameRate(10);
// put a point in centre of pg graphics
int px=xsize/2;
int py=ysize/2;
pixel=(px+(py*xsize));
pg.pixels[pixel] = color(200,200,200);
pg.updatePixels();
image(pg,0,0,1500,500);
noLoop();
position();
}
// get a point that is not 0
void position() {
px=int((random(1,xsize-1)));
py=int((random(1,ysize-1)));
pixel=(px+(py*xsize));
float rr=(red(pg.pixels[pixel]));
if(rr==0) {
position();
}
draw();
}
// main loop
void draw() {
noLoop();
println(px);
}
I’ll get there one day!!
Just can’t understand why so difficult in Processing and not any other languages.
Here it is in basic sub routine: position being the sub routine.
position:
randomize
x=(int(rnd(xmax)))
y=(int(rnd(ymax)))
get pixel x,y color r2,g2,b2
if r2=0 then goto position
return
Can anyone do this in Processing because I have tried everything.
Something sooooo simple can’t be done.
It’s as easy as 2+2 !
???