aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util/glsl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-30 03:41:38 +0200
committerSven Gothel <[email protected]>2011-08-30 03:41:38 +0200
commit7f2da7bb878813817efab0eb01bbf274065ef6c6 (patch)
tree6c4df36439747e239c84f88e676c4a6145738c54 /src/jogl/classes/com/jogamp/opengl/util/glsl
parentb8b25bb01b826e1216551c8f3d192bcec670e265 (diff)
GLSL DataArray/Handler: Remove ShaderState state and pass it through: ShaderState.getShaderState(gl)
This removes the dependency of a GLSL GLDataArray object to a specific ShaderState and enables sharing of this VBO data, i.e. via a shared context. Test: TestSharedContextVBOES2NEWT
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java7
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java5
2 files changed, 7 insertions, 5 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 a2a012e08..36abd9d4d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -49,7 +49,8 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
public class ShaderState {
public static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.GLSLState", true, AccessController.getContext());
-
+ private static final String currentStateKey = "jogamp.opengl.glsl.ShaderState" ;
+
public ShaderState() {
}
@@ -78,7 +79,7 @@ public class ShaderState {
* @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState()
*/
public static synchronized ShaderState getShaderState(GL gl) {
- return (ShaderState) gl.getContext().getAttachedObject(ShaderState.class.getName());
+ return (ShaderState) gl.getContext().getAttachedObject(currentStateKey);
}
/**
@@ -141,7 +142,7 @@ public class ShaderState {
if(null==shaderProgram) { throw new GLException("No program is attached"); }
if(on) {
// update the current ShaderState to the TLS ..
- gl.getContext().attachObject(ShaderState.class.getName(), this);
+ gl.getContext().attachObject(currentStateKey, this);
if(shaderProgram.linked()) {
shaderProgram.useProgram(gl, true);
if(resetAllShaderData) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
index c81e1f961..9ccd38bf1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -461,11 +461,12 @@ public class ShaderUtil {
private static Impl getImpl(GL _gl) {
GL2ES2 gl = _gl.getGL2ES2();
GLContext context = gl.getContext();
- Impl impl = (Impl) context.getAttachedObject(ShaderUtil.class.getName());
+ Impl impl = (Impl) context.getAttachedObject(implObjectKey);
if (impl == null) {
impl = new GL2ES2Impl();
- context.attachObject(ShaderUtil.class.getName(), impl);
+ context.attachObject(implObjectKey, impl);
}
return impl;
}
+ private static final String implObjectKey = "jogamp.opengl.glsl.ShaderUtilImpl" ;
}