summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-04 00:36:17 +0200
committerSven Gothel <[email protected]>2012-10-04 00:36:17 +0200
commit3ae26ed8a9f0d4394c5b1e22d8246c2cdf391b2e (patch)
tree902747cb392ffd11d9f0c0b9a304955fc80ff209 /src/jogl
parenta644d779ab19cb1d200ae4ba567b9c042c34b337 (diff)
ShaderState: Adding Class API doc and removing attached object w/ 'int' key, similar to GLContext change 6d241fc2a46413ee478985d676d2481c5a7ed119
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
index 62082aacd..2bfd7f391 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -42,9 +42,20 @@ import javax.media.opengl.GLUniformData;
import jogamp.opengl.Debug;
import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.opengl.util.GLArrayDataEditable;
+/**
+ * ShaderState allows to sharing data between shader programs,
+ * while updating the attribute and uniform locations when switching.
+ * <p>
+ * This allows seamless switching of programs using <i>almost</i> same data
+ * but performing different artifacts.
+ * </p>
+ * <p>
+ * A {@link #useProgram(GL2ES2, boolean) used} ShaderState is attached to the current GL context
+ * and can be retrieved via {@link #getShaderState(GL)}.
+ * </p>
+ */
public class ShaderState {
public static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.GLSLState", true);
private static final String currentStateKey = "jogamp.opengl.glsl.ShaderState" ;
@@ -123,25 +134,6 @@ public class ShaderState {
}
/**
- * Returns the attached user object for the given name to this ShaderState.
- */
- public final Object getAttachedObject(int name) {
- return attachedObjectsByInt.get(name);
- }
-
- /**
- * Attach user object for the given name to this ShaderState.
- * Returns the previously set object or null.
- */
- public final Object attachObject(int name, Object obj) {
- return attachedObjectsByInt.put(name, obj);
- }
-
- public final Object detachObject(int name) {
- return attachedObjectsByInt.remove(name);
- }
-
- /**
* Turns the shader program on or off.<br>
* Puts this ShaderState to to the thread local storage (TLS),
* if <code>on</code> is <code>true</code>.
@@ -262,7 +254,6 @@ public class ShaderState {
public synchronized void destroy(GL2ES2 gl) {
release(gl, true, true, true);
attachedObjectsByString.clear();
- attachedObjectsByInt.clear();
}
/**
@@ -1044,7 +1035,6 @@ public class ShaderState {
private ArrayList<GLUniformData> managedUniforms = new ArrayList<GLUniformData>();
private HashMap<String, Object> attachedObjectsByString = new HashMap<String, Object>();
- private IntObjectHashMap attachedObjectsByInt = new IntObjectHashMap();
private boolean resetAllShaderData = false;
}