diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java index 3ed41893a..32bba896f 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java @@ -28,22 +28,19 @@ package jogamp.opengl.util; -import javax.media.opengl.*; -import javax.media.opengl.fixedfunc.*; +import javax.media.opengl.GL; +import javax.media.opengl.GLException; +import javax.media.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.util.GLArrayDataEditable; -import java.nio.*; - /** * Used for 1:1 fixed function arrays, i.e. where the buffer data * represents this array only. */ -public class GLFixedArrayHandler implements GLArrayHandler { - private GLArrayDataEditable ad; - +public class GLFixedArrayHandler extends GLVBOArrayHandler implements GLArrayHandler { public GLFixedArrayHandler(GLArrayDataEditable ad) { - this.ad = ad; + super(ad); } public final void setSubArrayVBOName(int vboName) { @@ -57,19 +54,7 @@ public class GLFixedArrayHandler implements GLArrayHandler { public final void enableState(GL gl, boolean enable, Object ext) { final GLPointerFunc glp = gl.getGL2ES1(); if(enable) { - final Buffer buffer = ad.getBuffer(); - final boolean vboBound = ad.isVBO(); - if(vboBound) { - // 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); - } - } + final boolean vboBound = bindBuffer(gl, true); switch(ad.getIndex()) { case GLPointerFunc.GL_VERTEX_ARRAY: glp.glVertexPointer(ad); @@ -86,8 +71,9 @@ public class GLFixedArrayHandler implements GLArrayHandler { default: throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad); } - gl.glBindBuffer(ad.getVBOTarget(), 0); - + if(vboBound) { + bindBuffer(gl, false); + } glp.glEnableClientState(ad.getIndex()); } else { glp.glDisableClientState(ad.getIndex()); |