aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLStateTracker.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-01 15:14:39 +0200
committerSven Gothel <[email protected]>2011-08-01 15:14:39 +0200
commit2dbd16fc3edf29b39ba37a11b9fbf1b2aad75c45 (patch)
tree70367f094a969e9387b506cef79ee846b0bd6d3b /src/jogl/classes/jogamp/opengl/GLStateTracker.java
parent0f0f6162cfbce1ad7db86e7e627721c4c918933c (diff)
StateTracker: Map's KeyNotFound value -1 -> 0xffffffff... allowing unusual values. Impl -> final.
Map's KeyNotFound value -1 -> 0xffffffff Turns out some GL impl. use VBO names like 0xa2d67443, which is (int) < 0. This is now handled in GLBufferStateTracker as well as for the others. Make methods final to restrict 'em.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLStateTracker.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLStateTracker.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
index 3bf06ac7a..391f96aed 100644
--- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
@@ -75,45 +75,45 @@ public class GLStateTracker {
/**
* set (client) pixel-store state, deep copy
*/
- private void setPixelStateMap(IntIntHashMap pixelStateMap) {
+ private final void setPixelStateMap(IntIntHashMap pixelStateMap) {
this.pixelStateMap = (IntIntHashMap) pixelStateMap.clone();
}
/**
* get (client) pixel-store state, return reference
*/
- private IntIntHashMap getPixelStateMap() { return pixelStateMap; }
+ private final IntIntHashMap getPixelStateMap() { return pixelStateMap; }
}
public GLStateTracker() {
pixelStateMap = new IntIntHashMap(PIXEL_STATE_MAP_CAPACITY, 0.75f);
- pixelStateMap.setKeyNotFoundValue(-1);
+ pixelStateMap.setKeyNotFoundValue(0xFFFFFFFF);
resetStates();
stack = new ArrayList<SavedState>(MIN_CLIENT_ATTRIB_STACK_DEPTH);
}
- public void clearStates(boolean enable) {
+ public final void clearStates(boolean enable) {
enabled = enable;
pixelStateMap.clear();
}
- public void setEnabled(boolean on) {
+ public final void setEnabled(boolean on) {
enabled = on;
}
- public boolean isEnabled() {
+ public final boolean isEnabled() {
return enabled;
}
/** @return true if found in our map, otherwise false,
* which forces the caller to query GL. */
- public boolean getInt(int pname, int[] params, int params_offset) {
+ public final boolean getInt(int pname, int[] params, int params_offset) {
if(enabled) {
int value = pixelStateMap.get(pname);
- if(0 <= value) {
+ if(0xFFFFFFFF != value) {
params[params_offset] = value;
return true;
}
@@ -123,10 +123,10 @@ public class GLStateTracker {
/** @return true if found in our map, otherwise false,
* which forces the caller to query GL. */
- public boolean getInt(int pname, IntBuffer params, int dummy) {
+ public final boolean getInt(int pname, IntBuffer params, int dummy) {
if(enabled) {
int value = pixelStateMap.get(pname);
- if(0 <= value) {
+ if(0xFFFFFFFF != value) {
params.put(params.position(), value);
return true;
}
@@ -134,13 +134,13 @@ public class GLStateTracker {
return false;
}
- public void setInt(int pname, int param) {
+ public final void setInt(int pname, int param) {
if(enabled) {
pixelStateMap.put(pname, param);
}
}
- public void pushAttrib(int flags) {
+ public final void pushAttrib(int flags) {
if(enabled) {
SavedState state = new SavedState(); // empty-slot
if( 0 != (flags&GL2.GL_CLIENT_PIXEL_STORE_BIT) ) {
@@ -151,7 +151,7 @@ public class GLStateTracker {
}
}
- public void popAttrib() {
+ public final void popAttrib() {
if(enabled) {
if(stack.isEmpty()) {
throw new GLException("stack contains no elements");
@@ -169,7 +169,7 @@ public class GLStateTracker {
}
}
- private void resetStates() {
+ private final void resetStates() {
pixelStateMap.clear();
// 16 values -> PIXEL_STATE_MAP_SIZE