From 0388ebbe4a403f51e95c906cd15f5c498b8ddf2e Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 3 Oct 2013 13:51:56 -0400 Subject: [PATCH] takes care of #2102 by reverting setAmbient to false if it was false before calling popStyle() --- core/src/processing/opengl/PGraphicsOpenGL.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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)