diff options
author | Sven Gothel <[email protected]> | 2011-08-30 03:41:38 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-08-30 03:41:38 +0200 |
commit | 7f2da7bb878813817efab0eb01bbf274065ef6c6 (patch) | |
tree | 6c4df36439747e239c84f88e676c4a6145738c54 /src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java | |
parent | b8b25bb01b826e1216551c8f3d192bcec670e265 (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/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java index 5c4aa718c..0d6da7ba4 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java @@ -31,7 +31,9 @@ package jogamp.opengl.util.glsl; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLArrayData; -import com.jogamp.opengl.util.GLArrayHandler; + +import jogamp.opengl.util.GLArrayHandler; + import com.jogamp.opengl.util.glsl.ShaderState; /** @@ -39,11 +41,9 @@ import com.jogamp.opengl.util.glsl.ShaderState; * separately and interleaves many arrays. */ public class GLSLArrayHandlerFlat implements GLArrayHandler { - private ShaderState st; private GLArrayData ad; - public GLSLArrayHandlerFlat(ShaderState st, GLArrayData ad) { - this.st = st; + public GLSLArrayHandlerFlat(GLArrayData ad) { this.ad = ad; } @@ -51,15 +51,17 @@ public class GLSLArrayHandlerFlat implements GLArrayHandler { throw new UnsupportedOperationException(); } - public final void syncData(GL gl, boolean enable) { + public final void syncData(GL gl, boolean enable, Object ext) { + final ShaderState st = (ShaderState) ext; if(enable) { st.vertexAttribPointer(gl.getGL2ES2(), ad); } } - public final void enableState(GL gl, boolean enable) { + public final void enableState(GL gl, boolean enable, Object ext) { final GL2ES2 glsl = gl.getGL2ES2(); - + final ShaderState st = (ShaderState) ext; + if(enable) { st.enableVertexAttribArray(glsl, ad); } else { |