aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl/impl')
-rw-r--r--src/classes/com/sun/opengl/impl/glsl/GLSLArrayDataServer.java23
-rw-r--r--src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java10
2 files changed, 17 insertions, 16 deletions
diff --git a/src/classes/com/sun/opengl/impl/glsl/GLSLArrayDataServer.java b/src/classes/com/sun/opengl/impl/glsl/GLSLArrayDataServer.java
index b56c2dc92..14613227e 100644
--- a/src/classes/com/sun/opengl/impl/glsl/GLSLArrayDataServer.java
+++ b/src/classes/com/sun/opengl/impl/glsl/GLSLArrayDataServer.java
@@ -22,6 +22,11 @@ public class GLSLArrayDataServer extends GLArrayDataServer {
init(name, -1, comps, dataType, normalized, 0, null, 0, initialSize, glBufferUsage, true);
}
+ protected final void passVertexAttribPointer(GL2ES2 gl, ShaderState st) {
+ if ( ! st.glVertexAttribPointer(gl, this) ) {
+ throw new RuntimeException("Internal Error");
+ }
+ }
protected void enableBufferGLImpl(GL gl, boolean enable) {
GL2ES2 glsl = gl.getGL2ES2();
@@ -34,23 +39,27 @@ public class GLSLArrayDataServer extends GLArrayDataServer {
if(!st.glEnableVertexAttribArray(glsl, name)) {
throw new RuntimeException("Internal Error");
}
- bufferEnabled = true;
if(vboUsage) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
if(!bufferWritten) {
- gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * getBufferCompSize(), buffer, glBufferUsage);
+ if(null!=buffer) {
+ gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * getComponentSize(), buffer, glBufferUsage);
+ }
+ bufferWritten=true;
}
+ passVertexAttribPointer(glsl, st);
+ } else if(null!=buffer) {
+ passVertexAttribPointer(glsl, st);
+ bufferWritten=true;
}
- if ( ! st.glVertexAttribPointer(glsl, this) ) {
- throw new RuntimeException("Internal Error");
- }
- bufferWritten=true;
} else {
+ if(vboUsage) {
+ gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
+ }
if(!st.glDisableVertexAttribArray(glsl, name)) {
throw new RuntimeException("Internal Error");
}
- bufferEnabled = false;
}
}
diff --git a/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java b/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java
index f9798f48a..27b3aeeac 100644
--- a/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java
+++ b/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java
@@ -26,14 +26,6 @@ public class FixedFuncPipeline {
return shaderState;
}
- public void enableLighting(boolean enable) {
- lightingEnabled=enable;
- }
-
- public boolean lightingEnabled() {
- return lightingEnabled;
- }
-
public int getActiveTextureUnit() {
return activeTextureUnit;
}
@@ -318,7 +310,7 @@ public class FixedFuncPipeline {
} else {
shaderState.attachShaderProgram(gl, shaderProgramColor);
}
- }
+ }
if(DEBUG) {
System.out.println("validate: "+this);
}