diff options
author | Sven Gothel <[email protected]> | 2012-10-12 21:38:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-12 21:38:36 +0200 |
commit | 1992d24671f8d99abccb671b8f9d5a7cd474fd00 (patch) | |
tree | 108ada7dcba74e5700861caf6fbc80673c4eeb45 /src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java | |
parent | 2958508131e5f0b3336f07c6f1c2865eb954921b (diff) |
GLArrayData* VBO binding: Properly document and impl. bindBuffer(..) in detail w/ data sync within GLArrayHandle,
which also removed redundant code (VBO data sync and binding).
Refines commit 8582ece7dc7f65271b3184261697a542766d9864
and f49f8e22953ed2426fd4264ee407e2dc3fc07cfc
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java index 1e882e080..862d49d1d 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java @@ -28,21 +28,20 @@ package jogamp.opengl.util; -import javax.media.opengl.*; +import javax.media.opengl.GL; +import javax.media.opengl.GLException; -import com.jogamp.opengl.util.*; +import com.jogamp.opengl.util.GLArrayDataEditable; -import java.nio.*; /** * Used for pure VBO data arrays, i.e. where the buffer data * does not represents a specific array name. */ -public class GLDataArrayHandler implements GLArrayHandler { - private GLArrayDataEditable ad; +public class GLDataArrayHandler extends GLVBOArrayHandler implements GLArrayHandler { public GLDataArrayHandler(GLArrayDataEditable ad) { - this.ad = ad; + super(ad); } public final void setSubArrayVBOName(int vboName) { @@ -59,19 +58,8 @@ public class GLDataArrayHandler implements GLArrayHandler { // makes no sense otherwise throw new GLException("GLDataArrayHandler can only handle VBOs."); } - Buffer buffer = ad.getBuffer(); - - // always bind and refresh the VBO mgr, - // in case more than one gl*Pointer objects are in use - gl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName()); - if(!ad.isVBOWritten()) { - if(null!=buffer) { - gl.glBufferData(ad.getVBOTarget(), buffer.limit() * ad.getComponentSizeInBytes(), buffer, ad.getVBOUsage()); - } - ad.setVBOWritten(true); - } - gl.glBindBuffer(ad.getVBOTarget(), 0); - + bindBuffer(gl, true); + bindBuffer(gl, false); } // no array association } |