From 87ff90fb03216737df70ff83246664b7fba2663e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 22 Aug 2011 16:38:45 +0200 Subject: Fix regression of commit 6c346d98f04e2355210960fe9ffde47432f04d62, where VBO/attribute binding wasn't updated (VBO data written, shader change/switch attribute on same location) ; Optimized interleaved GLSL VBO binding, hence split up GLArrayHandler syncData/enableState --- .../util/glsl/GLSLArrayHandlerInterleaved.java | 46 ++++++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java') diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java index ba5814a09..c662c13d2 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java @@ -60,21 +60,22 @@ public class GLSLArrayHandlerInterleaved implements GLArrayHandler { subArrays.add(handler); } - private final void enableSubBuffer(GL gl, boolean enable) { + private final void syncSubData(GL gl, boolean enable) { for(int i=0; i= 0) { + // didn't experience a performance hit on this query .. + // (using ShaderState's location query above to validate the location) + final int[] qi = new int[1]; + glsl.glGetVertexAttribiv(ad.getLocation(), GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, qi, 0); + if(ad.getVBOName() != qi[0]) { + glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName()); + syncSubData(gl, true); + } + } + } else if(null!=buffer) { + syncSubData(gl, true); + } } else { - enableSubBuffer(gl, false); + syncSubData(gl, false); if(ad.isVBO()) { glsl.glBindBuffer(ad.getVBOTarget(), 0); } - } + } + } + + public final void enableState(GL gl, boolean enable) { + for(int i=0; i