diff options
author | Sven Gothel <[email protected]> | 2011-10-07 19:59:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-07 19:59:29 +0200 |
commit | 274df7766467ca79dbd593d59aa1e4908d40cfa5 (patch) | |
tree | c3770d2b6d96101b5c5eaa13b86fbaae26177f6d /src/jogl/classes/com/jogamp/opengl/util | |
parent | c8eab433735f5da0779843b227e2f0f5057df776 (diff) |
GLArrayData<VBO>: Add GLArrayHandlerFlat ; Update VBO name to interleaved subarrays
- Add GLArrayHandlerFlat gives better distinction of semantics
- update sub-array VBO name, if parent's interleaved array initializes it.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java index d3bb2e3fd..8d9d839e2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java @@ -16,6 +16,7 @@ import jogamp.opengl.util.GLFixedArrayHandler; import jogamp.opengl.util.GLFixedArrayHandlerFlat; import jogamp.opengl.util.glsl.GLSLArrayHandler; import jogamp.opengl.util.glsl.GLSLArrayHandlerFlat; +import jogamp.opengl.util.glsl.GLSLArrayHandlerInterleaved; public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataEditable { @@ -224,15 +225,14 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE if(usesGLSL) { throw new GLException("buffer uses GLSL"); } - GLArrayDataWrapper ad = GLArrayDataWrapper.createFixed( + final GLArrayDataWrapper ad = GLArrayDataWrapper.createFixed( index, comps, getComponentType(), getNormalized(), getStride(), getBuffer(), getVBOName(), interleavedOffset, getVBOUsage(), vboTarget); ad.setVBOEnabled(isVBO()); interleavedOffset += comps * getComponentSizeInBytes(); if(GL.GL_ARRAY_BUFFER == vboTarget) { - GLArrayHandler handler = new GLFixedArrayHandlerFlat(ad); - glArrayHandler.addSubHandler(handler); + glArrayHandler.addSubHandler(new GLFixedArrayHandlerFlat(ad)); } return ad; } @@ -253,7 +253,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE throws GLException { GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, comps, dataType, false, 0, null, initialSize, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -280,15 +280,14 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE if(!usesGLSL) { throw new GLException("buffer uses fixed function"); } - GLArrayDataWrapper ad = GLArrayDataWrapper.createGLSL( + final GLArrayDataWrapper ad = GLArrayDataWrapper.createGLSL( name, comps, getComponentType(), getNormalized(), getStride(), getBuffer(), getVBOName(), interleavedOffset, getVBOUsage(), vboTarget); ad.setVBOEnabled(isVBO()); interleavedOffset += comps * getComponentSizeInBytes(); if(GL.GL_ARRAY_BUFFER == vboTarget) { - GLArrayHandler handler = new GLSLArrayHandlerFlat(ad); - glArrayHandler.addSubHandler(handler); + glArrayHandler.addSubHandler(new GLSLArrayHandlerFlat(ad)); } return ad; } @@ -371,6 +370,9 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE int[] tmp = new int[1]; gl.glGenBuffers(1, tmp, 0); vboName = tmp[0]; + if(0 < interleavedOffset) { + glArrayHandler.setSubArrayVBOName(vboName); + } } } |