aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.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/RenderState.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/RenderState.java')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index 88392ea04..ed5bcb110 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -60,7 +60,7 @@ public class RenderState {
* Shall be set via {@link #setHintMask(int)} and cleared via {@link #clearHintMask(int)}.
* </p>
* <p>
- * If set, {@link GLRegion#draw(GL2ES2, RegionRenderer, int, int[]) GLRegion's draw-method}
+ * If set, {@link GLRegion#draw(GL2ES2, RegionRenderer) GLRegion's draw-method}
* will set the proper {@link GL#glBlendFuncSeparate(int, int, int, int) blend-function}
* and the clear-color to <i>transparent-black</i> in case of {@link Region#isTwoPass(int) multipass} FBO rendering.
* </p>
@@ -79,7 +79,7 @@ public class RenderState {
* Shall be set via {@link #setHintMask(int)} and cleared via {@link #clearHintMask(int)}.
* </p>
* <p>
- * {@link GLRegion#draw(GL2ES2, RegionRenderer, int, int[]) GLRegion's draw-method}
+ * {@link GLRegion#draw(GL2ES2, RegionRenderer) GLRegion's draw-method}
* may toggle depth test, and reset it's state according to this hint.
* </p>
* <p>
@@ -98,6 +98,10 @@ public class RenderState {
private final FloatBuffer weightBuffer;
private final float[] colorStatic;
private final FloatBuffer colorStaticBuffer;
+ /** Pass2 AA-quality rendering {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT}. */
+ private int aaQuality;
+ /** Default pass2 AA sample count {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
+ private int sampleCount;
/** Optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix. Null if unused. */
private AABBox clipBBox;
private int hintBitfield;
@@ -199,6 +203,8 @@ public class RenderState {
this.weightBuffer = FloatBuffer.wrap(weight);
this.colorStatic = new float[] { 1, 1, 1, 1 };
this.colorStaticBuffer = FloatBuffer.wrap(colorStatic);
+ this.aaQuality = Region.DEFAULT_AA_QUALITY;
+ this.sampleCount = Region.DEFAULT_AA_SAMPLE_COUNT;
this.clipBBox = null;
this.hintBitfield = 0;
this.sp = null;
@@ -265,6 +271,16 @@ public class RenderState {
colorStatic[3] = a;
}
+ /** Sets pass2 AA-quality rendering value clipped to the range [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}] for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT}. */
+ public final int setAAQuality(final int v) { final int q=Region.clipAAQuality(v); this.aaQuality=q; return q;}
+ /** Returns pass2 AA-quality rendering value for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT}. */
+ public final int getAAQuality() { return this.aaQuality; }
+
+ /** Sets pass2 AA sample count clipped to the range [{@link Region#MIN_AA_SAMPLE_COUNT}..{@link Region#MAX_AA_SAMPLE_COUNT}] for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
+ public final int setSampleCount(final int v) { final int s=Region.clipAASampleCount(v); this.sampleCount=s; return s;}
+ /** Returns pass2 AA sample count for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
+ public final int getSampleCount() { return this.sampleCount; }
+
/** Set the optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix or null to disable. */
public final void setClipBBox(final AABBox clipBBox) { this.clipBBox = clipBBox; }
/** Returns the optional Mv-premultiplied clipping {@link AABBox} or null if unused. */