Thanks for the reply. Changing to your function didn’t seem to help. I am looping over the pixels with two nested for loops. It lags when just calling the function in the for loop and nothing else.
void setup() {
size(1000,920, P2D);
frameRate(60);
noStroke();
noSmooth();
}
static PVector ret = new PVector(0,0,0);
static final PVector kaleido(PVector uv) {
final float r = uv.magSq() * .1, th = sin(7 * uv.heading());
return ret.set(cos(th) * r, sin(th) * r);
}
int frames = 0;
void draw() {
frames++;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
kaleido(new PVector(1,1,1));
}
}
text(frames, 10, 30);
}
What does the function kaleido do? At the moment it does nothing because you are passing the same information to it 920000 times a frame, no wonder it’s slow you are creating 982000 PVector objects every frame.