do not call handleDraw() after the sketch is finished

This commit is contained in:
codeanticode
2016-10-30 10:23:16 -03:00
parent d596697dee
commit 52d4880d88
+12 -10
View File
@@ -874,18 +874,20 @@ public class PSurfaceJOGL implements PSurface {
requestFocus();
}
pgl.getGL(drawable);
int pframeCount = sketch.frameCount;
sketch.handleDraw();
if (pframeCount == sketch.frameCount) {
// This hack allows the FBO layer to be swapped normally even if
// the sketch is no looping, otherwise background artifacts will occur.
pgl.beginRender();
pgl.endRender(sketch.sketchWindowColor());
if (!sketch.finished) {
pgl.getGL(drawable);
int pframeCount = sketch.frameCount;
sketch.handleDraw();
if (pframeCount == sketch.frameCount || sketch.finished) {
// This hack allows the FBO layer to be swapped normally even if
// the sketch is no looping or finished because it does not call draw(),
// otherwise background artifacts may occur (depending on the hardware/drivers).
pgl.beginRender();
pgl.endRender(sketch.sketchWindowColor());
}
PGraphicsOpenGL.completeFinishedPixelTransfers();
}
PGraphicsOpenGL.completeFinishedPixelTransfers();
if (sketch.exitCalled()) {
PGraphicsOpenGL.completeAllPixelTransfers();