When run, the first circle is visible, but the second circle does not appear. If I remove the calls to loadPixels() and updatePixels(), both circles appear as expected.
Is there a way I can draw shapes in between calls to loadPixels() and updatePixels()? The project I’m working on requires this and it would be difficult/less performant to implement differently.
updatePixels() will write your pixels buffer back, as you have seen. That is what it is for. Why are you loading – to read values, or to modify values? If you are only calling loadPixels to read values, like color c = pixels[y*width+x]; then just don’t updatePixels() at all.
void setup() {
size(200, 100);
}
void draw() {
fill(0);
ellipseMode(CENTER);
ellipse(50, 50, 50, 50);
loadPixels();
// why are you loading, anyway?
// call get() or read pixels[] here
color c = pixels[mouseY*width+mouseX];
fill(c);
// if you didn't set pixels[] or call set(),
// then don't call:
// updatePixels();
ellipse(150, 50, 50, 50);
}