We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm running into some odd problems with PGraphics with Processing 2.1, but am posting here before submitting a bug report. The following code works fine with the default renderer, but throws a ConcurrentModificationException
when using P3D or OpenGL. I also note that without the vertex
portion of the code, there is no error. I'm not sure if it that means that's the cause, or it just needed enough going on to break things.
PGraphics pg;
void setup() {
size(300, 300, OPENGL);
int i = 0;
while (true) {
println(i);
pg = createGraphics(width, height, OPENGL);
pg.beginDraw();
pg.background(0);
pg.beginShape();
pg.stroke(255);
for (int j=0; j<10; j++) {
pg.vertex(random(width), random(height));
}
pg.endShape();
pg.endDraw();
i += 1;
}
}
Has anyone else had these problems? Any suggestions?
Answers
Further tests: any shapes drawn like above cause the error, not just
beginShape()
. This also occurs when running in thedraw()
loop.But it appears that creating the
PGraphics
once in the setup and usingpg.clear()
might be a solution.