Hello,
When I’m updating the pixels of an PImage in a different thread this somehow effects the background of my main (P3D) sketch (on both Mac and Window). Even when the image is not bound as a texture. Any idea?
PImage img;
boolean loading;
void setup() {
size(1200, 1200, P3D);
img = createImage(2048, 1024, RGB);
}
void draw() {
background(0);
if (!loading) {
thread("loadFrame");
}
}
void loadFrame() {
loading=true;
img.loadPixels();
for (int i=0; i<img.width*img.height; i++) {
img.pixels[i] = color(i%255, 255, 255); //// UPDATE: calling color() inside the thread was causing it.
}
img.updatePixels();
loading=false;
}