diff options
author | Sven Gothel <[email protected]> | 2013-09-20 11:37:38 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-20 11:37:38 +0200 |
commit | 51df3f354a700454498371c0565bfcd6c0d3bf5f (patch) | |
tree | 9492a71383c2cbe83c410e0a2474cbe68dd98580 | |
parent | b1db882abfe6166abb5f06df8ff2d386e5f8f842 (diff) |
Bug 839: Clarifying GLStateTracker.clearStates(..) remove 'enable' change - Part 1
TODO: Only disable state tracker at GLContext.destroy()
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 13 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLStateTracker.java | 8 |
2 files changed, 12 insertions, 9 deletions
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) { // <init> bufferStateTracker.clearBufferObjectState(); } - if (glStateTracker != null) { // <init> - 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<SavedState>(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; |