summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph
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/graph
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/graph')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index e0d2490dc..eb07142a3 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -39,6 +39,7 @@ import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
public abstract class RenderState {
+ private static final String thisKey = "jogamp.graph.curve.RenderState" ;
public static RenderState createRenderState(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) {
return new RenderStateImpl(st, pointFactory);
@@ -48,6 +49,10 @@ public abstract class RenderState {
return new RenderStateImpl(st, pointFactory, pmvMatrix);
}
+ public static final RenderState getRenderState(GL2ES2 gl) {
+ return (RenderState) gl.getContext().getAttachedObject(thisKey);
+ }
+
protected final ShaderState st;
protected final Vertex.Factory<? extends Vertex> vertexFactory;
protected final PMVMatrix pmvMatrix;
@@ -76,13 +81,13 @@ public abstract class RenderState {
// public abstract GLUniformData getStrength();
public final RenderState attachTo(GL2ES2 gl) {
- return (RenderState) gl.getContext().attachObject(RenderState.class.getName(), this);
+ return (RenderState) gl.getContext().attachObject(thisKey, this);
}
public final boolean detachFrom(GL2ES2 gl) {
- RenderState _rs = (RenderState) gl.getContext().getAttachedObject(RenderState.class.getName());
+ RenderState _rs = (RenderState) gl.getContext().getAttachedObject(thisKey);
if(_rs == this) {
- gl.getContext().detachObject(RenderState.class.getName());
+ gl.getContext().detachObject(thisKey);
return true;
}
return false;