diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java | 11 |
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; |