aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-12 21:38:36 +0200
committerSven Gothel <[email protected]>2012-10-12 21:38:36 +0200
commit1992d24671f8d99abccb671b8f9d5a7cd474fd00 (patch)
tree108ada7dcba74e5700861caf6fbc80673c4eeb45 /src/jogl/classes/jogamp/graph
parent2958508131e5f0b3336f07c6f1c2865eb954921b (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/graph')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java18
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java10
2 files changed, 11 insertions, 17 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 765b94855..85d3ad5a7 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -220,16 +220,14 @@ public class VBORegion2PES2 extends GLRegion {
gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue());
fbo.use(gl, texA);
verticeFboAttr.enableBuffer(gl, true);
- texCoordFboAttr.enableBuffer(gl, true);
- indicesFbo.enableBuffer(gl, true);
+ texCoordFboAttr.enableBuffer(gl, true);
+ indicesFbo.bindBuffer(gl, true); // keeps VBO binding
- indicesFbo.bindBuffer(gl, true);
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
- indicesFbo.bindBuffer(gl, false);
- verticeFboAttr.enableBuffer(gl, false);
+ indicesFbo.bindBuffer(gl, false);
texCoordFboAttr.enableBuffer(gl, false);
- indicesFbo.enableBuffer(gl, false);
+ verticeFboAttr.enableBuffer(gl, false);
fbo.unuse(gl);
// setback: gl.glActiveTexture(currentActiveTextureEngine[0]);
@@ -289,15 +287,13 @@ public class VBORegion2PES2 extends GLRegion {
private void renderRegion(GL2ES2 gl) {
verticeTxtAttr.enableBuffer(gl, true);
texCoordTxtAttr.enableBuffer(gl, true);
- indicesTxt.enableBuffer(gl, true);
+ indicesTxt.bindBuffer(gl, true); // keeps VBO binding
- indicesTxt.bindBuffer(gl, true);
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementCount() * indicesTxt.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
- indicesTxt.bindBuffer(gl, false);
- verticeTxtAttr.enableBuffer(gl, false);
+ indicesTxt.bindBuffer(gl, false);
texCoordTxtAttr.enableBuffer(gl, false);
- indicesTxt.enableBuffer(gl, false);
+ verticeTxtAttr.enableBuffer(gl, false);
}
public void destroy(GL2ES2 gl, RenderState rs) {
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 7f3e937e1..0cba444ad 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -127,16 +127,14 @@ public class VBORegionSPES2 extends GLRegion {
protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
verticeAttr.enableBuffer(gl, true);
- texCoordAttr.enableBuffer(gl, true);
- indices.enableBuffer(gl, true);
+ texCoordAttr.enableBuffer(gl, true);
+ indices.bindBuffer(gl, true); // keeps VBO binding
- indices.bindBuffer(gl, true);
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementCount() * indices.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+
indices.bindBuffer(gl, false);
-
- verticeAttr.enableBuffer(gl, false);
texCoordAttr.enableBuffer(gl, false);
- indices.enableBuffer(gl, false);
+ verticeAttr.enableBuffer(gl, false);
}
public final void destroy(GL2ES2 gl, RenderState rs) {