aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/curve/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java13
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderUtil.java31
2 files changed, 12 insertions, 32 deletions
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 78c8660fa..7bf2ee6e1 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -27,12 +27,9 @@
*/
package com.jogamp.graph.curve.opengl;
-import java.util.List;
-
import javax.media.opengl.GL2ES2;
import com.jogamp.opengl.util.PMVMatrix;
-import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
/** A GLRegion is the OGL binding of one or more OutlineShapes
@@ -77,6 +74,16 @@ public abstract class GLRegion extends Region {
*/
public abstract void destroy(GL2ES2 gl, RegionRenderer renderer);
+ protected abstract void clearImpl(final GL2ES2 gl, final RegionRenderer renderer);
+
+ /**
+ * Clears all data, i.e. triangles, vertices etc.
+ */
+ public void clear(final GL2ES2 gl, final RegionRenderer renderer) {
+ clearImpl(gl, renderer);
+ clearImpl();
+ }
+
/**
* Renders the associated OGL objects specifying
* current width/hight of window for multi pass rendering
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderUtil.java
index b54fcd6a6..944050a14 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderUtil.java
@@ -74,7 +74,7 @@ public class TextRenderUtil {
final Font font, final CharSequence str, final int pixelSize) {
final int charCount = str.length();
- final GLRegion region = Region.create(renderModes);
+ final GLRegion region = GLRegion.create(renderModes);
// region.setFlipped(true);
final Font.Metrics metrics = font.getMetrics();
@@ -88,7 +88,6 @@ public class TextRenderUtil {
float y = 0;
float advanceTotal = 0;
- int numVertices = region.getNumVertices();
for(int i=0; i< charCount; i++) {
final char character = str.charAt(i);
@@ -110,33 +109,7 @@ public class TextRenderUtil {
if( null == glyphShape ) {
continue;
}
- // glyphShape.closeLastOutline();
-
- if( false ) {
- region.addOutlineShape(glyphShape, t);
- } else {
- // System.err.println("XXXXX Pre TRI");
- // glyphShape.getVertices();
- final ArrayList<Triangle> trisIn = glyphShape.getTriangles(OutlineShape.VerticesState.QUADRATIC_NURBS);
- final ArrayList<Vertex> gVertices = glyphShape.getVertices();
-
- if( gVertices.size() < 3 ) {
- continue;
- }
- region.addTriangles(trisIn, t, numVertices);
-
- for(int j=0; j<gVertices.size(); j++) {
- final Vertex vert = gVertices.get(j);
- final Vertex svert = t.transform(vert, null);
- svert.setId(numVertices++);
- if(Region.DEBUG_INSTANCE) {
- System.err.println("IN: "+vert);
- System.err.println("EX: "+svert);
- }
- region.addVertex(svert, null);
- }
- }
- assert( numVertices == region.getNumVertices() );
+ region.addOutlineShape(glyphShape, t);
advanceTotal += glyph.getAdvance(pixelSize, true);
}