diff options
author | Sven Gothel <[email protected]> | 2023-09-30 01:28:59 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-30 01:28:59 +0200 |
commit | 297c48f4fefd1ab59800524ea5f0dd56684d6786 (patch) | |
tree | 02c1b8f65de349c9af3bc2a5b94e04e90d75c684 /src/graphui/classes | |
parent | 2e46eb1bf06ef07801062122716aa99a6c871646 (diff) |
Bug 1465 - Graph / GraphUI: Render a Region's ColorTexture in proper aspect-ratio, letter-boxed or zoomed (config) + Bug 1466 Fix color mixing
Bug 1465: Region currently simply bloats a given texture to its region AABBox,
which renders textures with the wrong aspect ratio.
Add facility to program the texture-coordinates to either letter-box
or scaled-up (and cut) true aspect-ratio.
Default shall be zoom (scale-up and cut),
but user shall be able to set a flag in the Region for letter-box.
Have the shader clip texture coordinates properly,
best w/o branching to soothe performance.
See functions.glsl
+++
Bug 1466: Current color mix: texture * color_channel * color_static
is useless in GraphUI.
color_static shall modulate the texture, which works.
But in case of color_channel (attribute/varying)
we want it to be mixed so it can become the more dominant color
for e.g. a border.
Desired is:
color = vec4( mix( tex.rgb * gcu_ColorStatic.rgb, gcv_Color.rgb, gcv_Color.a ),
mix( tex.a * gcu_ColorStatic.a, 1, gcv_Color.a) );
Diffstat (limited to 'src/graphui/classes')
4 files changed, 16 insertions, 3 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java index a8d7c4295..d5a192456 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java @@ -76,7 +76,7 @@ public class GLButton extends TexSeqButton { this.glel = glel; this.useAlpha = useAlpha; - setColor(1.0f, 1.0f, 1.0f, 1.0f); + setColor(1.0f, 1.0f, 1.0f, 0.0f); setPressedColorMod(0.9f, 0.9f, 0.9f, 0.7f); setToggleOffColorMod(0.8f, 0.8f, 0.8f, 1.0f); setToggleOnColorMod(1.0f, 1.0f, 1.0f, 1.0f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/ImageButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/ImageButton.java index cd919546d..d8c79d8e7 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/ImageButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/ImageButton.java @@ -55,7 +55,7 @@ public class ImageButton extends TexSeqButton { final float height, final ImageSequence texSeq) { super(renderModes, width, height, texSeq); - setColor(1f, 1f, 1f, 1.0f); + setColor(1f, 1f, 1f, 0.0f); setPressedColorMod(0.9f, 0.9f, 0.9f, 0.9f); setToggleOffColorMod(1f, 1f, 1f, 1f); setToggleOnColorMod(0.8f, 0.8f, 0.8f, 1f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java index b73f224d1..ed44324de 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java @@ -68,7 +68,7 @@ public class MediaButton extends TexSeqButton { final float height, final GLMediaPlayer mPlayer) { super(renderModes, width, height, mPlayer); - setColor(1.0f, 1.0f, 1.0f, 1.0f); + setColor(1.0f, 1.0f, 1.0f, 0.0f); setPressedColorMod(0.9f, 0.9f, 0.9f, 0.7f); setToggleOffColorMod(0.8f, 0.8f, 0.8f, 1.0f); setToggleOnColorMod(1.0f, 1.0f, 1.0f, 1.0f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java index 0dbd11adf..de5c43be1 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/TexSeqButton.java @@ -55,6 +55,19 @@ public abstract class TexSeqButton extends BaseButton { public final TextureSequence getTextureSequence() { return this.texSeq; } + /** + * Sets a renderMode {@link Region#COLORTEXTURE_LETTERBOX_RENDERING_BIT} on or off. + * @return this instance for chaining + */ + public TexSeqButton setTextureLetterbox(final boolean v) { + if( getTextureLetterbox() != v ) { + renderModes = Region.setRenderMode(renderModes, Region.COLORTEXTURE_LETTERBOX_RENDERING_BIT, v); + markShapeDirty(); + } + return this; + } + public boolean getTextureLetterbox() { return Region.isColorTextureLetterbox(renderModes); } + @Override protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) { final OutlineShape shape = createBaseShape(0f); |