i’m trying to copy image information from one pgraphic to another (like trying to cache the old one and render it in the background) and it keeping having weird effects like it being linked together permanently when i use an = (i.e. pg1 = pg2;)
and i don’t know of any other variable that acts like this.
The moment you call pg2 = pg1 then pg1 and pg2 are pointing to the same graphics object and the original pg2 will disappear. This is how object references work in Processing and Java, and is different to primitives like int, float, etc.
What you need to do here is probably copy the contents of pg1 into pg2. eg.
void draw() {
t = t+1;
pg1.beginDraw();
pg1.ellipse(random(width),random(height),20,20);
pg1.endDraw();
if (t > 200) {
pg2.beginDraw();
pg2.image(pg1, 0, 0);
pg2.endDraw();
t = 0;
println("ping");
}
image(pg2,0,0);
}