aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
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/jogamp/opengl/util/glsl/GLSLArrayHandler.java
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/jogamp/opengl/util/glsl/GLSLArrayHandler.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
index d2fc52d5c..96bb02b19 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
@@ -33,8 +33,9 @@ import java.nio.Buffer;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
+import jogamp.opengl.util.GLArrayHandler;
+
import com.jogamp.opengl.util.GLArrayDataEditable;
-import com.jogamp.opengl.util.GLArrayHandler;
import com.jogamp.opengl.util.glsl.ShaderState;
/**
@@ -43,10 +44,8 @@ import com.jogamp.opengl.util.glsl.ShaderState;
*/
public class GLSLArrayHandler implements GLArrayHandler {
private GLArrayDataEditable ad;
- private ShaderState st;
- public GLSLArrayHandler(ShaderState st, GLArrayDataEditable ad) {
- this.st = st;
+ public GLSLArrayHandler(GLArrayDataEditable ad) {
this.ad = ad;
}
@@ -54,9 +53,10 @@ public class GLSLArrayHandler implements GLArrayHandler {
throw new UnsupportedOperationException();
}
- public final void syncData(GL gl, boolean enable) {
+ public final void syncData(GL gl, boolean enable, Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
-
+ final ShaderState st = (ShaderState) ext;
+
if(enable) {
final Buffer buffer = ad.getBuffer();
/*
@@ -100,9 +100,10 @@ public class GLSLArrayHandler implements GLArrayHandler {
}
}
- 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 {