aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java21
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java8
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java6
4 files changed, 35 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index 5a1524d05..30fc0012b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -171,7 +171,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
bufferEnabled = enable;
}
}
-
+
+ public void bindBuffer(GL gl, boolean bind) {
+ if(isVBO()) {
+ gl.glBindBuffer(getVBOTarget(), bind ? getVBOName() : 0);
+ }
+ }
+
public void setEnableAlways(boolean always) {
enableBufferAlways = always;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
index bb22a4b7e..588e90d1e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
@@ -45,9 +45,15 @@ public interface GLArrayDataEditable extends GLArrayData {
public void seal(GL gl, boolean seal);
/**
- * <p>Enables/disables the buffer,
- * sets the client state, binds the VBO if used
- * and transfers the data if necessary.</p>
+ * <p>
+ * Enables the buffer if <code>enable</code> is <code>true</code>,
+ * and transfers the data if required.
+ * In case {@link #isVBO() VBO is used}, it is bound accordingly for the data transfer and data association.
+ * The VBO buffer is unbound when the method returns.
+ * </p>
+ * <p>
+ * Disables the buffer if <code>enable</code> is <code>false</code>.
+ * </p>
*
* <p>The action will only be executed,
* if the internal enable state differs,
@@ -61,6 +67,15 @@ public interface GLArrayDataEditable extends GLArrayData {
* @see #setEnableAlways(boolean)
*/
public void enableBuffer(GL gl, boolean enable);
+
+ /**
+ * In case {@link #isVBO() VBO is used}, the buffer is bound
+ * if <code>bind</code> is <code>true</code>, otherwise the buffer is unbound.
+ *
+ * @param gl
+ * @param bind
+ */
+ public void bindBuffer(GL gl, boolean bind);
/**
* Affects the behavior of 'enableBuffer'.
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index aabef29b0..765b94855 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -223,7 +223,9 @@ public class VBORegion2PES2 extends GLRegion {
texCoordFboAttr.enableBuffer(gl, true);
indicesFbo.enableBuffer(gl, true);
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+ indicesFbo.bindBuffer(gl, true);
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+ indicesFbo.bindBuffer(gl, false);
verticeFboAttr.enableBuffer(gl, false);
texCoordFboAttr.enableBuffer(gl, false);
@@ -289,7 +291,9 @@ public class VBORegion2PES2 extends GLRegion {
texCoordTxtAttr.enableBuffer(gl, true);
indicesTxt.enableBuffer(gl, true);
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementCount() * indicesTxt.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+ indicesTxt.bindBuffer(gl, true);
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementCount() * indicesTxt.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+ indicesTxt.bindBuffer(gl, false);
verticeTxtAttr.enableBuffer(gl, false);
texCoordTxtAttr.enableBuffer(gl, false);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 14ff0380f..7f3e937e1 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -129,8 +129,10 @@ public class VBORegionSPES2 extends GLRegion {
verticeAttr.enableBuffer(gl, true);
texCoordAttr.enableBuffer(gl, true);
indices.enableBuffer(gl, true);
-
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementCount() * indices.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+
+ indices.bindBuffer(gl, true);
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementCount() * indices.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+ indices.bindBuffer(gl, false);
verticeAttr.enableBuffer(gl, false);
texCoordAttr.enableBuffer(gl, false);