summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/GraphShape.java30
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java2
4 files changed, 20 insertions, 16 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
index abe56eca3..1e2dc730a 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
@@ -126,7 +126,12 @@ public abstract class GraphShape extends Shape {
}
/**
- * Update or freshly create the {@link GLRegion}, while allocating its buffers with given initial `vertexCount` and `indexCount`.
+ * Reset the {@link GLRegion} and reserving its buffers to have a free capacity for `vertexCount` and `indexCount` elements.
+ *
+ * In case {@link GLRegion} is `null`, a new instance is being created.
+ *
+ * In case the {@link GLRegion} already exists, it will be either {@link GLRegion#clear(GL2ES2) cleared} if the {@link GL2ES2} `gl`
+ * instance is not `null` or earmarked for deletion at a later time and a new instance is being created.
*
* Method shall be invoked by the {@link #addShapeToRegion(GLProfile, GL2ES2)} implementation
* before actually adding the {@link OutlineShape} to the {@link GLRegion}.
@@ -134,21 +139,20 @@ public abstract class GraphShape extends Shape {
* {@link #addShapeToRegion(GLProfile, GL2ES2)} is capable to determine initial `vertexCount` and `indexCount` buffer sizes,
* as it composes the {@link OutlineShape}s to be added.
*
- * {@link #updateGLRegion(GLProfile, GL2ES2, TextureSequence, OutlineShape)} maybe used for convenience.
- *
- * In case {@link GLRegion} is `null`, a new instance is being created.
- *
- * In case the {@link GLRegion} already exists, it will be either {@link GLRegion#clear(GL2ES2) cleared} if the {@link GL2ES2} `gl`
- * instance is not `null` or earmarked for deletion at a later time and a new instance is being created.
+ * {@link #resetGLRegion(GLProfile, GL2ES2, TextureSequence, OutlineShape)} maybe used for convenience.
*
* @param glp the used GLProfile, never `null`
* @param gl the optional current {@link GL2ES2} instance, maybe `null`.
* @param colorTexSeq optional {@link TextureSequence} for {@link Region#COLORTEXTURE_RENDERING_BIT} rendering mode.
* @param vertexCount the initial {@link GLRegion} vertex buffer size
* @param indexCount the initial {@link GLRegion} index buffer size
- * @see #updateGLRegion(GLProfile, GL2ES2, TextureSequence, OutlineShape)
+ * @see #resetGLRegion(GLProfile, GL2ES2, TextureSequence, OutlineShape)
*/
- protected void updateGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, final int vertexCount, final int indexCount) {
+ protected void resetGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, int vertexCount, int indexCount) {
+ if( hasBorder() ) {
+ vertexCount += 8;
+ indexCount += 24;
+ }
if( null == region ) {
region = GLRegion.create(glp, renderModes, colorTexSeq, vertexCount, indexCount);
} else if( null == gl ) {
@@ -160,18 +164,18 @@ public abstract class GraphShape extends Shape {
}
}
/**
- * Convenient {@link #updateGLRegion(GLProfile, GL2ES2, TextureSequence, int, int)} variant determining initial
+ * Convenient {@link #resetGLRegion(GLProfile, GL2ES2, TextureSequence, int, int)} variant determining initial
* {@link GLRegion} buffer sizes via {@link Region#countOutlineShape(OutlineShape, int[])}.
*
* @param glp the used GLProfile, never `null`
* @param gl the optional current {@link GL2ES2} instance, maybe `null`.
* @param colorTexSeq optional {@link TextureSequence} for {@link Region#COLORTEXTURE_RENDERING_BIT} rendering mode.
* @param shape the {@link OutlineShape} used to determine {@link GLRegion}'s buffer sizes via {@link Region#countOutlineShape(OutlineShape, int[])}
- * @see #updateGLRegion(GLProfile, GL2ES2, TextureSequence, int, int)
+ * @see #resetGLRegion(GLProfile, GL2ES2, TextureSequence, int, int)
*/
- protected void updateGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, final OutlineShape shape) {
+ protected void resetGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, final OutlineShape shape) {
final int[/*2*/] vertIndexCount = Region.countOutlineShape(shape, new int[2]);
- updateGLRegion(glp, gl, colorTexSeq, vertIndexCount[0], vertIndexCount[1]);
+ resetGLRegion(glp, gl, colorTexSeq, vertIndexCount[0], vertIndexCount[1]);
}
@Override
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
index 3473c2c68..9a6ba7bc2 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java
@@ -105,7 +105,7 @@ public class Button extends BaseButton {
// Sum Region buffer size of base-shape + text
final int[/*2*/] vertIndexCount = Region.countOutlineShape(shape, new int[2]);
TextRegionUtil.countStringRegion(label.getFont(), label.getText(), vertIndexCount);
- updateGLRegion(glp, gl, null, vertIndexCount[0], vertIndexCount[1]);
+ resetGLRegion(glp, gl, null, vertIndexCount[0], vertIndexCount[1]);
region.addOutlineShape(shape, null, rgbaColor);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
index dd4398c63..c579cb943 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
@@ -192,7 +192,7 @@ public class GlyphShape extends GraphShape {
tmp.setToTranslation(-sbox.getMinX(), -sbox.getMinY() + glyph.getBounds().getMinY());
shape.setSharpness(oshapeSharpness);
- updateGLRegion(glp, gl, null, regionVertCount, regionIdxCount);
+ resetGLRegion(glp, gl, null, regionVertCount, regionIdxCount);
region.addOutlineShape(shape, tmp, rgbaColor);
box.resize(tmp.transform(sbox, new AABBox()));
setRotationPivot( box.getCenter() );
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
index c270903d9..b8edb74e2 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
@@ -205,7 +205,7 @@ public class Label extends GraphShape {
@Override
protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
final int[] vertIndCount = TextRegionUtil.countStringRegion(font, text, new int[2]);
- updateGLRegion(glp, gl, null, vertIndCount[0], vertIndCount[1]);
+ resetGLRegion(glp, gl, null, vertIndCount[0], vertIndCount[1]);
AABBox fbox = font.getGlyphBounds(text, tempT2, tempT3);
tempT1.setToScale(fontScale, fontScale);