From 51df3f354a700454498371c0565bfcd6c0d3bf5f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 20 Sep 2013 11:37:38 +0200 Subject: Bug 839: Clarifying GLStateTracker.clearStates(..) remove 'enable' change - Part 1 TODO: Only disable state tracker at GLContext.destroy() --- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 13 ++++++++----- src/jogl/classes/jogamp/opengl/GLStateTracker.java | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl') diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 22240c246..ff90966cd 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -148,8 +148,7 @@ public abstract class GLContextImpl extends GLContext { this.glDebugHandler = new GLDebugMessageHandler(this); } - @Override - protected void resetStates() { + private final void clearStates() { // Because we don't know how many other contexts we might be // sharing with (and it seems too complicated to implement the // GLObjectTracker's ref/unref scheme for the buffer-related @@ -158,14 +157,18 @@ public abstract class GLContextImpl extends GLContext { if (bufferSizeTracker != null) { bufferSizeTracker.clearCachedBufferSizes(); } - if (bufferStateTracker != null) { // bufferStateTracker.clearBufferObjectState(); } - if (glStateTracker != null) { // - glStateTracker.clearStates(false); + glStateTracker.setEnabled(false); + glStateTracker.clearStates(); } + } + + @Override + protected void resetStates() { + clearStates(); extensionAvailability = null; glProcAddressTable = null; diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java index 391f96aed..69411979f 100644 --- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java @@ -40,6 +40,7 @@ package jogamp.opengl; import javax.media.opengl.*; + import com.jogamp.common.util.IntIntHashMap; import java.nio.IntBuffer; import java.util.ArrayList; @@ -95,8 +96,7 @@ public class GLStateTracker { stack = new ArrayList(MIN_CLIENT_ATTRIB_STACK_DEPTH); } - public final void clearStates(boolean enable) { - enabled = enable; + public final void clearStates() { pixelStateMap.clear(); } @@ -112,7 +112,7 @@ public class GLStateTracker { * which forces the caller to query GL. */ public final boolean getInt(int pname, int[] params, int params_offset) { if(enabled) { - int value = pixelStateMap.get(pname); + final int value = pixelStateMap.get(pname); if(0xFFFFFFFF != value) { params[params_offset] = value; return true; @@ -125,7 +125,7 @@ public class GLStateTracker { * which forces the caller to query GL. */ public final boolean getInt(int pname, IntBuffer params, int dummy) { if(enabled) { - int value = pixelStateMap.get(pname); + final int value = pixelStateMap.get(pname); if(0xFFFFFFFF != value) { params.put(params.position(), value); return true; -- cgit v1.2.3