aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/curve/opengl
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-15 04:47:34 +0100
committerSven Göthel <[email protected]>2024-01-15 04:47:34 +0100
commitd7cb4a77b71cb3703ff7ac0667c5a97f29a5bdb4 (patch)
tree17cb67b7867f0da11a2717492d691a5e96f52636 /src/jogl/classes/com/jogamp/graph/curve/opengl
parent9b8d1825cfb76454e42b196a93dc54d189a8a9a6 (diff)
Graph/GraphUI AA-Quality (shader): Region: Add DEFAULT_AA_QUALITY and clipping funs for aaQuality/sampleCount; TextRegionUtil: Pass quality parameter in draw-functions
Region.DEFAULT_AA_QUALITY defaults to MAX_AA_QUALITY still - TODO: AA shader is subject to change .. Region.draw(..) clips the quality param (save) TextRegionUtil: Pass quality parameter in draw-functions - Allowing to select the AA shader GraphUI Scene and some demos add the AA-quality param to the status line or screenshot-filename. - See Region.getRenderModeString(..) +++ TestTextRendererNEWT20 and TestTextRendererNEWT21 now iterate through all fonts, AA-quality shader and sample-sizes. Most demos and some more tests take AA-quality into acount, demos via CommandlineOptions.graphAAQuality
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java31
2 files changed, 18 insertions, 15 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 718f543c2..dfc7d3921 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -539,7 +539,7 @@ public abstract class GLRegion extends Region {
if( isShapeDirty() ) {
updateImpl(gl, renderer, curRenderModes);
}
- drawImpl(gl, renderer, curRenderModes, pass2Quality, sampleCount);
+ drawImpl(gl, renderer, curRenderModes, Region.clipAAQuality(pass2Quality), sampleCount);
clearDirtyBits(DIRTY_SHAPE|DIRTY_STATE);
lastRenderModes = curRenderModes;
}
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 225f42830..633bc38af 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[], AffineTransform, AffineTransform)
+ * @see #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)
*/
public static int[] countStringRegion(final Font font, final CharSequence str, final int[/*2*/] vertIndexCount) {
final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
@@ -203,6 +203,7 @@ 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
@@ -210,7 +211,7 @@ public class TextRegionUtil {
*/
public AABBox drawString3D(final GL2ES2 gl,
final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int[/*1*/] sampleCount) {
+ final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
if( !renderer.isInitialized() ) {
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -231,20 +232,20 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCount);
+ region.draw(gl, renderer, aaQuality, sampleCount);
return res;
}
/**
- * Try using {@link #drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
+ * Try using {@link #drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, int, int[], 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[/*1*/] sampleCount) {
- return drawString3D(gl, renderModes, renderer, font, str, rgbaColor, sampleCount, new AffineTransform(), new AffineTransform());
+ final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
+ return drawString3D(gl, renderModes, renderer, font, str, rgbaColor, aaQuality, sampleCount, new AffineTransform(), new AffineTransform());
}
/**
@@ -261,7 +262,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[], AffineTransform, AffineTransform)}
+ * In such case better use {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)}
* instead.
* </p>
* @param gl the current GL state
@@ -271,6 +272,7 @@ 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
@@ -280,7 +282,7 @@ public class TextRegionUtil {
*/
public static AABBox drawString3D(final GL2ES2 gl, final int renderModes,
final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
+ final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
if(!renderer.isInitialized()){
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -293,20 +295,20 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCount);
+ region.draw(gl, renderer, aaQuality, sampleCount);
region.destroy(gl);
return res;
}
/**
- * Try using {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
+ * Try using {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], 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[/*1*/] sampleCount) {
- return drawString3D(gl, region, renderer, font, str, rgbaColor, sampleCount, new AffineTransform(), new AffineTransform());
+ 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());
}
/**
@@ -331,6 +333,7 @@ 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
@@ -340,7 +343,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[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
+ final int aaQuality, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
if(!renderer.isInitialized()){
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -352,7 +355,7 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCount);
+ region.draw(gl, renderer, aaQuality, sampleCount);
return res;
}