aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
index bb22a4b7e..9a0f1cb37 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
@@ -14,7 +14,7 @@ import java.nio.*;
public interface GLArrayDataEditable extends GLArrayData {
public boolean sealed();
-
+
public boolean enabled();
/**
@@ -31,6 +31,7 @@ public interface GLArrayDataEditable extends GLArrayData {
// Data and GL state modification ..
//
+ @Override
public void destroy(GL gl);
public void reset(GL gl);
@@ -40,19 +41,24 @@ public interface GLArrayDataEditable extends GLArrayData {
*
* @see #seal(boolean)
* @see #enableBuffer(GL, boolean)
- *
+ *
*/
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>
- *
+ * 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 association,
+ * i.e. it issued {@link #bindBuffer(GL, boolean)}.
+ * The VBO buffer is unbound when the method returns.
+ * <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,
+ * if the internal enable state differs,
* or 'setEnableAlways' was called with 'true'.</b>
- *
+ *
* <p>It is up to the user to enable/disable the array properly,
* ie in case of multiple data sets for the same vertex attribute (VA).
* Meaning in such case usage of one set while expecting another one
@@ -63,11 +69,31 @@ public interface GLArrayDataEditable extends GLArrayData {
public void enableBuffer(GL gl, boolean enable);
/**
+ * if <code>bind</code> is true and the data uses {@link #isVBO() VBO},
+ * the latter will be bound and data written to the GPU if required.
+ * <p>
+ * If <code>bind</code> is false and the data uses {@link #isVBO() VBO},
+ * the latter will be unbound.
+ * </p>
+ * <p>
+ * This method is exposed to allow data VBO arrays, i.e. {@link GL#GL_ELEMENT_ARRAY_BUFFER},
+ * to be bounded and written while keeping the VBO bound. The latter is in contrast to {@link #enableBuffer(GL, boolean)},
+ * which leaves the VBO unbound, since it's not required for vertex attributes or pointers.
+ * </p>
+ *
+ * @param gl current GL object
+ * @param bind true if VBO shall be bound and data written,
+ * otherwise clear VBO binding.
+ * @return true if data uses VBO and action was performed, otherwise false
+ */
+ public boolean bindBuffer(GL gl, boolean bind);
+
+ /**
* Affects the behavior of 'enableBuffer'.
*
* The default is 'false'
*
- * This is useful when you mix up
+ * This is useful when you mix up
* GLArrayData usage with conventional GL array calls
* or in case of a buggy GL VBO implementation.
*
@@ -92,7 +118,7 @@ public interface GLArrayDataEditable extends GLArrayData {
* ie position:=limit and limit:=capacity.</p>
*
* @see #seal(boolean)
- */
+ */
public void seal(boolean seal);
public void rewind();