diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 23c86cae0..324f58761 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -977,6 +977,9 @@ in */ String currentRenderer = g.getClass().getName(); if (currentRenderer.equals(irenderer)) { // println("calling setRendererSize from size() " + iwidth + " " + iheight); + // Avoid infinite loop of throwing exception to reset renderer + if (width == iwidth && height == iheight) return; + setRendererSize(iwidth, iheight); setSize(iwidth, iheight); // if ((iwidth != g.width) || (iheight != g.height)) { @@ -1006,13 +1009,12 @@ in */ // this is the function that will run if the user does their own // size() command inside setup, so set defaultSize to false. defaultSize = false; - - // throw an exception so that setup() is called again - // but with a properly sized render - // this is for opengl, which needs a valid, properly sized - // display before calling anything inside setup(). - throw new RuntimeException(NEW_RENDERER); } + // throw an exception so that setup() is called again + // but with a properly sized render + // this is for opengl, which needs a valid, properly sized + // display before calling anything inside setup(). + throw new RuntimeException(NEW_RENDERER); } } diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index c182bd0bd..e217b2805 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -774,7 +774,7 @@ public abstract class PGraphics extends PImage implements PConstants { // is what's desired). // this background() call is for the Java 2D and OpenGL renderers. if (mainDrawingSurface) { - //System.out.println("main drawing surface " + getClass().getName()); + //System.out.println("main drawing surface bg " + getClass().getName()); background(backgroundColor); }