Already called beginDraw() for another PGraphicsOpenGL object.
in
Core Library Questions
•
1 year ago
(There was a post about this error a day or two ago on this forum, but it seems to have disappeared now, so maybe it's been fixed already.)
I'm having problems with Processing 2.0b3 using beginDraw with two offscreen PGraphics objects at the same time. A sample program is below. The reason I get this situation is actually that I have one offscreen buffer that is worked on in draw() and another that is worked on by captureEvent(). This code works fine in Processing 1.5.1; and I see in the Processing source code for
opengl/PGraphicsOpenGL.java where this error seems to be coming from; but is it really not possible any more to have rendering to two different offscreen buffers overlap?
PGraphics pg; PGraphics opg; void setup() { size(100, 100, P2D); pg = createGraphics(80, 80, P2D); opg = createGraphics(80, 80, P2D); pg.beginDraw(); pg.background(102); pg.stroke(255); opg.beginDraw(); opg.background(102); opg.stroke(255); opg.line(20, 20, 80, 80); opg.endDraw(); pg.line(20, 20, 80, 80); pg.image(opg, 50, 50); pg.endDraw(); noLoop(); } void draw() { image(pg, 10, 10); }
1