aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-02-27 23:57:39 +0100
committerSven Gothel <[email protected]>2014-02-27 23:57:39 +0100
commitbd43319992d02f8194dce94587de476ee421891b (patch)
treef60bf3762c7591decd3ff1647b6de22e98b2f8b8 /src
parent67ec86e539a3db0d06e5cc3550db453589594384 (diff)
Bug 801: Graph TextRenderer Cleanup Part-5: *Region API Cleanup (protected impl. part)
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/Region.java14
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java23
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java13
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java13
4 files changed, 27 insertions, 36 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index 359c63c80..d23de2077 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -110,18 +110,10 @@ public abstract class Region {
this.renderModes = regionRenderModes;
}
- /**
- * Returns true, if the implementation uses indices to render the vertices,
- * otherwise false.
- * <p>
- * Impacts {@link #validateIndices()} and {@link #addOutlineShape(OutlineShape, AffineTransform)} ..,
- * i.e. defines unique indices if this method returns true.
- * </p>
- */
- public abstract boolean usesIndices();
+ // FIXME: Better handling of impl. buffer growth .. !
- public abstract void pushVertex(float[] coords, float[] texParams);
- public abstract void pushIndex(int idx);
+ protected abstract void pushVertex(float[] coords, float[] texParams);
+ protected abstract void pushIndex(int idx);
/**
* Return bit-field of render modes, see {@link #create(int)}.
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index 7bf2ee6e1..6d0e5e538 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -61,18 +61,15 @@ public abstract class GLRegion extends Region {
super(renderModes);
}
- /** Updates a graph region by updating the ogl related
- * objects for use in rendering if {@link #isDirty()}.
- * <p>Allocates the ogl related data and initializes it the 1st time.<p>
- * <p>Called by {@link #draw(GL2ES2, RenderState, int, int, int)}.</p>
- * @param rs TODO
+ /**
+ * Updates a graph region by updating the ogl related
+ * objects for use in rendering if {@link #isDirty()}.
+ * <p>Allocates the ogl related data and initializes it the 1st time.<p>
+ * <p>Called by {@link #draw(GL2ES2, RenderState, int, int, int)}.</p>
*/
protected abstract void update(GL2ES2 gl, RegionRenderer renderer);
- /** Delete and clean the associated OGL
- * objects
- */
- public abstract void destroy(GL2ES2 gl, RegionRenderer renderer);
+ protected abstract void destroyImpl(GL2ES2 gl, RegionRenderer renderer);
protected abstract void clearImpl(final GL2ES2 gl, final RegionRenderer renderer);
@@ -85,6 +82,14 @@ public abstract class GLRegion extends Region {
}
/**
+ * Delete and clear the associated OGL objects.
+ */
+ public final void destroy(GL2ES2 gl, RegionRenderer renderer) {
+ clear(gl, renderer);
+ destroyImpl(gl, renderer);
+ }
+
+ /**
* Renders the associated OGL objects specifying
* current width/hight of window for multi pass rendering
* of the region.
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 9c3e3f2c2..df3be2e06 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -82,7 +82,7 @@ public class VBORegion2PES2 extends GLRegion {
}
@Override
- public final void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) {
+ protected final void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) {
indicesTxtBuffer.seal(gl, false);
indicesTxtBuffer.rewind();
verticeTxtAttr.seal(gl, false);
@@ -92,10 +92,7 @@ public class VBORegion2PES2 extends GLRegion {
}
@Override
- public final boolean usesIndices() { return true; }
-
- @Override
- public final void pushVertex(float[] coords, float[] texParams) {
+ protected final void pushVertex(float[] coords, float[] texParams) {
verticeTxtAttr.putf(coords[0]);
verticeTxtAttr.putf(coords[1]);
verticeTxtAttr.putf(coords[2]);
@@ -105,12 +102,12 @@ public class VBORegion2PES2 extends GLRegion {
}
@Override
- public final void pushIndex(int idx) {
+ protected final void pushIndex(int idx) {
indicesTxtBuffer.puts((short)idx);
}
@Override
- public void update(final GL2ES2 gl, final RegionRenderer renderer) {
+ protected void update(final GL2ES2 gl, final RegionRenderer renderer) {
if(null == indicesFbo) {
final ShaderState st = renderer.getShaderState();
@@ -276,7 +273,7 @@ public class VBORegion2PES2 extends GLRegion {
}
@Override
- public void destroy(final GL2ES2 gl, final RegionRenderer renderer) {
+ protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Destroy: " + this);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index af0c4c980..f4c40b0e5 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -56,7 +56,7 @@ public class VBORegionSPES2 extends GLRegion {
}
@Override
- public final void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) {
+ protected final void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) {
indicesBuffer.seal(gl, false);
indicesBuffer.rewind();
verticeAttr.seal(gl, false);
@@ -66,10 +66,7 @@ public class VBORegionSPES2 extends GLRegion {
}
@Override
- public final boolean usesIndices() { return true; }
-
- @Override
- public final void pushVertex(float[] coords, float[] texParams) {
+ protected final void pushVertex(float[] coords, float[] texParams) {
verticeAttr.putf(coords[0]);
verticeAttr.putf(coords[1]);
verticeAttr.putf(coords[2]);
@@ -79,12 +76,12 @@ public class VBORegionSPES2 extends GLRegion {
}
@Override
- public final void pushIndex(int idx) {
+ protected final void pushIndex(int idx) {
indicesBuffer.puts((short)idx);
}
@Override
- public void update(final GL2ES2 gl, final RegionRenderer renderer) {
+ protected void update(final GL2ES2 gl, final RegionRenderer renderer) {
if( !buffersAttached ) {
final ShaderState st = renderer.getShaderState();
st.ownAttribute(verticeAttr, true);
@@ -119,7 +116,7 @@ public class VBORegionSPES2 extends GLRegion {
}
@Override
- public void destroy(final GL2ES2 gl, final RegionRenderer renderer) {
+ protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Destroy: " + this);
}