diff options
author | Sven Gothel <[email protected]> | 2023-04-19 20:55:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-19 20:55:36 +0200 |
commit | 920efa82bf88a30b1180687955b175fc9c3abc1d (patch) | |
tree | a65b7f3e06701dec2931e5fa6c588a6e3c8e09af /src | |
parent | eaa7891dbd430a9fe04f7b7d0e4e4764af4e6aa2 (diff) |
Graph [GL]Region: Use small initial indices/vertices count (640 -> 16), since (huge) text glyph gets always pre-calculated.
Region.countOutlineShape() indices ceiling raised from 60% to 90% of vertices, otherwise gets exceeded too often later on.
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/Region.java | 2 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index 5201d07b1..ef2bbf494 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -497,7 +497,7 @@ public abstract class Region { final int verticeCount = vertsIn.size() + shape.getAddedVerticeCount(); final int indexCount = trisIn.size() * 3; vertIndexCount[0] += verticeCount; - vertIndexCount[1] += Math.min( Math.ceil(verticeCount * 0.6), indexCount ); + vertIndexCount[1] += Math.min( Math.ceil(verticeCount * 0.9), indexCount ); } } 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 6b8aeb04b..b0f87c023 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -74,18 +74,21 @@ public abstract class GLRegion extends Region { * - Ubuntu Light ~ vertices 100/char, indices 50/char
* - FreeSerif ~ vertices 115/char, indices 61/char
*
- * Now let's assume a minimum of 10 chars will be rendered
+ * However, proper initial size is pre-calculated via ..
+ * - {@link GLRegion#create(GLProfile, int, TextureSequence, Font, CharSequence)}
+ * - {@Link Region#countOutlineShape(OutlineShape, int[])}
+ * - {@link TextRegionUtil#countStringRegion(Font, CharSequence, int[])}
*/
/**
- * Default initial vertices count based on 10 chars w/ FreeSans @ 64 vertices/char avg.
+ * Default initial vertices count {@value}, assuming small sized shapes.
*/
- public static final int defaultVerticesCount = 10*64;
+ public static final int defaultVerticesCount = 16;
/**
- * Default initial indices count based on 10 chars w/ FreeSans @ 33 indices/char avg.
+ * Default initial indices count {@value}, assuming small sized shapes.
*/
- public static final int defaultIndicesCount = 10*33;
+ public static final int defaultIndicesCount = 16;
// private static final float growthFactor = 1.2f; // avg +5% size but 15% more overhead (34% total)
protected static final float growthFactor = GLArrayDataClient.DEFAULT_GROWTH_FACTOR; // avg +20% size, but 15% less CPU overhead compared to 1.2 (19% total)
|