diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java index 6c8e2e762..8a587980d 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java @@ -28,55 +28,43 @@ 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. + * 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 { public GLDataArrayHandler(GLArrayDataEditable ad) { - this.ad = ad; + super(ad); } + @Override public final void setSubArrayVBOName(int vboName) { throw new UnsupportedOperationException(); } - + + @Override public final void addSubHandler(GLArrayHandlerFlat handler) { throw new UnsupportedOperationException(); } - - public final void syncData(GL gl, boolean enable, Object ext) { - if(!ad.isVBO()) { - // makes no sense otherwise - throw new GLException("GLDataArrayHandler can only handle VBOs."); - } - if(enable) { - 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); + @Override + public final void enableState(GL gl, boolean enable, Object ext) { + if(enable) { + if(!ad.isVBO()) { + // makes no sense otherwise + throw new GLException("GLDataArrayHandler can only handle VBOs."); } - } else { - gl.glBindBuffer(ad.getVBOTarget(), 0); - } - } - - public final void enableState(GL gl, boolean enable, Object ext) { - // no array association + bindBuffer(gl, true); + bindBuffer(gl, false); + } + // no array association } } |