Skip to content

Commit a2d161d

Browse files
committed
don't call swapBuffers() in PGraphicsOpenGL.dispose() for offscreen
surfaces.
1 parent 5516b17 commit a2d161d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,15 @@ protected void allocate() {
626626
public void dispose() { // PGraphics
627627
super.dispose();
628628

629-
// Swap buffers the end to make sure that no
630-
// garbage is shown on the screen, this particularly
631-
// affects non-interactive sketches on windows that
632-
// render only 1 frame, so no enough rendering
633-
// iterations have been conducted so far to properly
634-
// initialize all the buffers.
635-
pgl.swapBuffers();
629+
if (primarySurface) {
630+
// Swap buffers the end to make sure that no
631+
// garbage is shown on the screen, this particularly
632+
// affects non-interactive sketches on windows that
633+
// render only 1 frame, so no enough rendering
634+
// iterations have been conducted so far to properly
635+
// initialize all the buffers.
636+
pgl.swapBuffers();
637+
}
636638

637639
deletePolyBuffers();
638640
deleteLineBuffers();

0 commit comments

Comments
 (0)