aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-16 05:02:24 +0100
committerSven Göthel <[email protected]>2024-01-16 05:02:24 +0100
commit6b1979992a7da2573c420ce3eb22f35abcbd35b7 (patch)
tree5786a3286a773ccc3082977e1888c13b3f481dc9 /src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
parent33ec9480da3d414a4c973607970afa06b5ed79ca (diff)
Graph/GraphUI AA-Quality + SampleCount (shader): Push params down to RegionRenderer's RenderState usually rarely set from top of user API, reducing complexity.
Discussion: Alternative was to pass AA-Quality same as SampleCount from the top (e.g. GraphUI Scene), however, this convolutes the API even more. Both parameter modify the resulting shader code in pass2 rendering (only). The used 'renderMode' is still maintained within the Region, since it contains more dynamic states individual to each Region instance (color-texture, ..). This despite 'renderMode' also changes the RenderState's shader program. In the end, it really doesn't matter and is a choice of frequency - the pipeline is usually rendering from on OpenGL rendering thread sequentially. AA-Quality and SampleCount simply usually don't change that often and are set only once.
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java47
1 files changed, 18 insertions, 29 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
index 633bc38af..5d60e2686 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
@@ -168,7 +168,7 @@ public class TextRegionUtil {
* @return the given int[2] storage for chaining
* @see Region#setBufferCapacity(int, int)
* @see Region#growBuffer(int, int)
- * @see #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)
+ * @see #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)
*/
public static int[] countStringRegion(final Font font, final CharSequence str, final int[/*2*/] vertIndexCount) {
final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
@@ -203,15 +203,11 @@ public class TextRegionUtil {
* @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
* and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
* Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
- * @param aaQuality pass2 AA-quality, clipped to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}]
- * @param sampleCount desired multisampling sample count for msaa-rendering.
- * The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.
* @return the bounding box of the given string from the produced and rendered GLRegion
* @throws Exception if TextRenderer not initialized
*/
- public AABBox drawString3D(final GL2ES2 gl,
- final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
+ public AABBox drawString3D(final GL2ES2 gl, final RegionRenderer renderer,
+ final Font font, final CharSequence str, final Vec4f rgbaColor) {
if( !renderer.isInitialized() ) {
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -232,20 +228,19 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, aaQuality, sampleCount);
+ region.draw(gl, renderer);
return res;
}
/**
- * Try using {@link #drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
+ * Try using {@link #drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
* <p>
* The region's buffer size is pre-calculated via {@link GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)}
* </p>
*/
- public static AABBox drawString3D(final GL2ES2 gl, final int renderModes,
- final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
- return drawString3D(gl, renderModes, renderer, font, str, rgbaColor, aaQuality, sampleCount, new AffineTransform(), new AffineTransform());
+ public static AABBox drawString3D(final GL2ES2 gl, final int renderModes, final RegionRenderer renderer,
+ final Font font, final CharSequence str, final Vec4f rgbaColor) {
+ return drawString3D(gl, renderModes, renderer, font, str, rgbaColor, new AffineTransform(), new AffineTransform());
}
/**
@@ -262,7 +257,7 @@ public class TextRegionUtil {
* <p>
* In case of a multisampling region renderer, i.e. {@link Region#VBAA_RENDERING_BIT}, recreating the {@link GLRegion}
* is a huge performance impact.
- * In such case better use {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)}
+ * In such case better use {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)}
* instead.
* </p>
* @param gl the current GL state
@@ -272,17 +267,14 @@ public class TextRegionUtil {
* @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
* and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
* Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
- * @param aaQuality pass2 AA-quality, clipped to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}]
- * @param sampleCount desired multisampling sample count for msaa-rendering.
- * The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.
* @param tmp1 temp {@link AffineTransform} to be reused
* @param tmp2 temp {@link AffineTransform} to be reused
* @throws Exception if TextRenderer not initialized
* @return the bounding box of the given string from the produced and rendered GLRegion
*/
- public static AABBox drawString3D(final GL2ES2 gl, final int renderModes,
- final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
+ public static AABBox drawString3D(final GL2ES2 gl, final int renderModes, final RegionRenderer renderer,
+ final Font font, final CharSequence str, final Vec4f rgbaColor,
+ final AffineTransform tmp1, final AffineTransform tmp2) {
if(!renderer.isInitialized()){
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -295,20 +287,20 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, aaQuality, sampleCount);
+ region.draw(gl, renderer);
region.destroy(gl);
return res;
}
/**
- * Try using {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
+ * Try using {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
* <p>
* The region buffer's size is grown by pre-calculating required size via {@link #countStringRegion(Font, CharSequence, int[])}.
* </p>
*/
public static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer,
- final Font font, final CharSequence str, final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
- return drawString3D(gl, region, renderer, font, str, rgbaColor, aaQuality, sampleCount, new AffineTransform(), new AffineTransform());
+ final Font font, final CharSequence str, final Vec4f rgbaColor) {
+ return drawString3D(gl, region, renderer, font, str, rgbaColor, new AffineTransform(), new AffineTransform());
}
/**
@@ -333,9 +325,6 @@ public class TextRegionUtil {
* @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
* and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
* Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
- * @param aaQuality pass2 AA-quality, clipped to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}]
- * @param sampleCount desired multisampling sample count for msaa-rendering.
- * The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.
* @param tmp1 temp {@link AffineTransform} to be reused
* @param tmp2 temp {@link AffineTransform} to be reused
* @return the bounding box of the given string from the produced and rendered GLRegion
@@ -343,7 +332,7 @@ public class TextRegionUtil {
*/
public static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer,
final Font font, final CharSequence str, final Vec4f rgbaColor,
- final int aaQuality, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
+ final AffineTransform tmp1, final AffineTransform tmp2) {
if(!renderer.isInitialized()){
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -355,7 +344,7 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, aaQuality, sampleCount);
+ region.draw(gl, renderer);
return res;
}