PGraphics thread issues

So, i have a program in processing, that creates a grid of pgraphics to use a canvas.

Basically what it does, is loop through a list of different sized pgraphics, and in a thread creates a new pgraphics and sets the old one to the new one.

PGraphics changeTile(PGraphics old) {
PGraphics new = createGraphics(old.width, old.height);
return new;
}
for(int i = 0; i < gridlist.length; i++) {
gridlist[i] = changeTile(gridlist[i]);
}

What is happening, is i am using these in a thread, and for some reason the tiles get resized to the first size? (i don’t know whats happening)
image

The white part is the tiles that were rendered in the thread. the dark gray part is the tile before. when reporting the width of that tile, it is firstly 8, then 128 (thats the size of the first tile!)

I don’t know if this is a problem on my side or a glitch.

-Libby

Hi @Noodlybanan,

You need to show more of your code, especially the thread handling to get analysed…

Cheers
— mnse

1 Like

I’m very sorry, there isn’t an error anywhere. I’m just stupid.

for (int i = 0; i < parts.length; i++) {
  parts[i] = brushengine.brush(parts[1], 32, 32, i);
}

i put ‘1’ instead of i.

1 Like