aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-03-05 03:28:37 +0100
committerSven Gothel <[email protected]>2011-03-05 03:28:37 +0100
commita167589233db343ac22b761d30d9dcd73016fe54 (patch)
treed921c22fdc88a0150ec0e521b3e5e3498b9e303c /src/jogl/classes/jogamp/opengl
parenta96aa3a46487c768f8e39440a83b2390389a6256 (diff)
Fix GLStateTracker PixelStore popAttrib(): Only write new state if corresponding push was of ClientPixelStore type
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLStateTracker.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
index 22874c0c3..e31187bf6 100644
--- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
@@ -59,14 +59,25 @@ public class GLStateTracker {
private IntIntHashMap pixelStateMap;
static class SavedState {
+ /**
+ * Empty pixel-store state
+ */
SavedState() {
this.pixelStateMap = null;
}
+
+ /**
+ * set (client) pixel-store state
+ */
void putPixelStateMap(IntIntHashMap pixelStateMap) {
this.pixelStateMap = new IntIntHashMap();
this.pixelStateMap.setKeyNotFoundValue(-1);
this.pixelStateMap.putAll(pixelStateMap);
}
+
+ /**
+ * get (client) pixel-store state
+ */
IntIntHashMap getPixelStateMap() { return pixelStateMap; }
private IntIntHashMap pixelStateMap;
@@ -127,11 +138,12 @@ public class GLStateTracker {
public void pushAttrib(int flags) {
if(enabled) {
- SavedState state = new SavedState();
+ SavedState state = new SavedState(); // empty-slot
if( 0 != (flags&GL2.GL_CLIENT_PIXEL_STORE_BIT) ) {
+ // save client pixel-store state
state.putPixelStateMap(pixelStateMap);
}
- stack.add(0, state);
+ stack.add(0, state); // push
}
}
@@ -140,21 +152,19 @@ public class GLStateTracker {
if(stack.size()==0) {
throw new GLException("stack contains no elements");
}
- SavedState state = (SavedState) stack.remove(0);
+ SavedState state = (SavedState) stack.remove(0); // pop
if(null==state) {
throw new GLException("null stack element (remaining stack size "+stack.size()+")");
}
- IntIntHashMap pixelStateMapNew = new IntIntHashMap();
- pixelStateMapNew.setKeyNotFoundValue(-1);
if ( null != state.getPixelStateMap() ) {
- pixelStateMapNew.putAll(state.getPixelStateMap());
- }
- pixelStateMap = pixelStateMapNew;
+ // use pulled client pixel-store state from stack
+ pixelStateMap = state.getPixelStateMap();
+ } // else: empty-slot, not pushed by GL_CLIENT_PIXEL_STORE_BIT
}
}
- public void resetStates() {
+ private void resetStates() {
pixelStateMap.clear();
pixelStateMap.put(GL.GL_PACK_ALIGNMENT, 4);