diff options
author | Sven Gothel <[email protected]> | 2014-02-23 14:51:06 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-02-23 14:51:06 +0100 |
commit | 3352601e0860584509adf2b76f993d03893ded4b (patch) | |
tree | 974fccc8c0eb2f5ad9d4ffd741dfc35869ed67b5 /src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java | |
parent | f51933f0ebe9ae030c26c066e59a728ce08b8559 (diff) | |
parent | c67de337a8aaf52e36104c3f13e273aa19d21f1f (diff) |
Merge branch 'master' into stash_glyphcache
Conflicts:
make/scripts/tests.sh
src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
src/jogl/classes/com/jogamp/graph/curve/Region.java
src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
src/jogl/classes/com/jogamp/graph/font/Font.java
src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java | 61 |
1 files changed, 22 insertions, 39 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java index d31b41582..89e01edd8 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java @@ -28,8 +28,6 @@ package jogamp.opengl.util; - -import java.nio.Buffer; import java.util.ArrayList; import java.util.List; @@ -38,61 +36,46 @@ import javax.media.opengl.GL; import com.jogamp.opengl.util.GLArrayDataEditable; /** - * Interleaved fixed function arrays, i.e. where this buffer data - * represents many arrays. + * Interleaved fixed function arrays, i.e. where this buffer data + * represents many arrays. */ -public class GLArrayHandlerInterleaved implements GLArrayHandler { - private GLArrayDataEditable ad; - private List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>(); +public class GLArrayHandlerInterleaved extends GLVBOArrayHandler { + private final List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>(); public GLArrayHandlerInterleaved(GLArrayDataEditable ad) { - this.ad = ad; + super(ad); } - + + @Override public final void setSubArrayVBOName(int vboName) { for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).getData().setVBOName(vboName); - } + } } - + + @Override public final void addSubHandler(GLArrayHandlerFlat handler) { subArrays.add(handler); } - private final void syncSubData(GL gl, boolean enable, boolean force, Object ext) { + private final void syncSubData(GL gl, Object ext) { for(int i=0; i<subArrays.size(); i++) { - subArrays.get(i).syncData(gl, enable, force, ext); - } - } - - public final void syncData(GL gl, boolean enable, Object ext) { - if(enable) { - final Buffer buffer = ad.getBuffer(); + subArrays.get(i).syncData(gl, ext); + } + } - if(ad.isVBO()) { - // 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); - } - } - syncSubData(gl, true, true, ext); - } else { - syncSubData(gl, false, true, ext); - if(ad.isVBO()) { - gl.glBindBuffer(ad.getVBOTarget(), 0); + @Override + public final void enableState(GL gl, boolean enable, Object ext) { + if(enable) { + final boolean vboBound = bindBuffer(gl, true); + syncSubData(gl, ext); + if(vboBound) { + bindBuffer(gl, false); } } - } - - public final void enableState(GL gl, boolean enable, Object ext) { for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).enableState(gl, enable, ext); - } + } } } |