diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index ba671f35d..fe238db2e 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -4519,8 +4519,20 @@ public class PGraphicsOpenGL extends PGraphics { return nonZero(ow) ? oz / ow : oz; } + ////////////////////////////////////////////////////////////// + // STYLES + @Override + public void popStyle() { + // popStyle() sets ambient to true (because it calls ambient() in style()) + // and so setting the setAmbient flag to true, even if the user didn't call + // ambient, so need to revert to false. + boolean savedSetAmbient = setAmbient; + super.popStyle(); + if (!savedSetAmbient) setAmbient = false; + } + // public void pushStyle() // public void popStyle() // public void style(PStyle)