diff options
author | Sven Gothel <[email protected]> | 2023-04-28 12:43:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-28 12:43:36 +0200 |
commit | 3ddcde7f2fd21e0a418f756519e42ee190ede07e (patch) | |
tree | 1d391e44b9e5a9d4ef3d3da80069c01101febcb7 /src/graphui/classes/com/jogamp | |
parent | 87814f1c86b132a16ddf6822d05b83c3ed091fe2 (diff) |
GraphUI Colors: Use pure white modulation w/ color-channel on no-action for original color, adjust defaults accordingly
Diffstat (limited to 'src/graphui/classes/com/jogamp')
5 files changed, 57 insertions, 23 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java index 5f88550dd..e9bf840ef 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java @@ -72,6 +72,13 @@ import com.jogamp.opengl.util.PMVMatrix; * <p> * GraphUI is intended to become an immediate- and retained-mode API. * </p> + * <p> + * Default colors (toggle-off is full color): + * - non-toggle: 0.6 * color, static -> 0.6 + * - pressed: 0.8 * color, static -> 0.5 + * - toggle-off: 1.0 * color, static -> 0.6 + * - toggle-on: 0.8 * color + * </p> * @see Scene */ public abstract class Shape { @@ -123,13 +130,16 @@ public abstract class Shape { private final Object dirtySync = new Object(); /** Default base-color w/o color channel, will be modulated w/ pressed- and toggle color */ - protected final Vec4f rgbaColor = new Vec4f(0.75f, 0.75f, 0.75f, 1.0f); - /** Default pressed color-factor w/o color channel, modulated base-color. 0.75 * 1.2 = 0.9 */ - protected final Vec4f pressedRGBAModulate = new Vec4f(1.20f, 1.20f, 1.20f, 0.7f); - /** Default toggle color-factor w/o color channel, modulated base-color. 0.75 * 1.13 ~ 0.85 */ - protected final Vec4f toggleOnRGBAModulate = new Vec4f(1.13f, 1.13f, 1.13f, 1.0f); - /** Default toggle color-factor w/o color channel, modulated base-color. 0.75 * 0.86 ~ 0.65 */ - protected final Vec4f toggleOffRGBAModulate = new Vec4f(0.86f, 0.86f, 0.86f, 1.0f); + protected final Vec4f rgbaColor = new Vec4f(0.60f, 0.60f, 0.60f, 1.0f); + /** Default pressed color-factor (darker and slightly transparent), modulated base-color. ~0.65 (due to alpha) */ + protected final Vec4f pressedRGBAModulate = new Vec4f(0.70f, 0.70f, 0.70f, 0.8f); + /** Default toggle color-factor (darkest), modulated base-color. 0.60 * 0.83 ~= 0.50 */ + protected final Vec4f toggleOnRGBAModulate = new Vec4f(0.83f, 0.83f, 0.83f, 1.0f); + /** Default toggle color-factor, modulated base-color. 0.60 * 1.00 ~= 0.60 */ + protected final Vec4f toggleOffRGBAModulate = new Vec4f(1.00f, 1.00f, 1.00f, 1.0f); + + private final Vec4f rgba_tmp = new Vec4f(0, 0, 0, 1); + private final Vec4f cWhite = new Vec4f(1, 1, 1, 1); private int name = -1; @@ -417,8 +427,6 @@ public abstract class Shape { } } - private final Vec4f rgba_tmp = new Vec4f(0, 0, 0, 1); - /** * Renders the shape. * <p> @@ -441,7 +449,7 @@ public abstract class Shape { rgba = toggleOffRGBAModulate; } } else { - rgba = rgbaColor; + rgba = cWhite; } } else { rgba = rgba_tmp; @@ -1319,6 +1327,13 @@ public abstract class Shape { protected abstract void validateImpl(final GLProfile glp, final GL2ES2 gl); + /** + * Actual draw implementation + * @param gl + * @param renderer + * @param sampleCount + * @param rgba if null, caller is {@link #drawToSelect(GL2ES2, RegionRenderer, int[])}, otherwise regular {@#link #draw(GL2ES2, RegionRenderer, int[])} + */ protected abstract void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount, Vec4f rgba); protected abstract void clearImpl0(final GL2ES2 gl, final RegionRenderer renderer); diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java index 9a6ba7bc2..5fe99c5c9 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Button.java @@ -76,11 +76,7 @@ public class Button extends BaseButton { final float height) { super(renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height); this.labelZOffset = DEFAULT_LABEL_ZOFFSET; - this.label = new Label0(labelFont, labelText, new Vec4f( 1.33f, 1.33f, 1.33f, 1.0f )); // 0.75 * 1.33 = 1.0 - setColor(0.75f, 0.75f, 0.75f, 1.0f); - setPressedColorMod(0.9f, 0.9f, 0.9f, 0.7f); - setToggleOffColorMod(0.65f, 0.65f, 0.65f, 1.0f); - setToggleOnColorMod(0.85f, 0.85f, 0.85f, 1.0f); + this.label = new Label0(labelFont, labelText, new Vec4f( 1.66f, 1.66f, 1.66f, 1.0f )); // 0.60 * 1.66 ~= 1.0 } public Font getFont() { return label.getFont(); } 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 f11475b84..57af3587c 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java @@ -54,6 +54,13 @@ import com.jogamp.opengl.util.texture.Texture; * This button is rendered with a round oval shape. * To render it rectangular, {@link #setCorner(float)} to zero. * </p> + * <p> + * Default colors (toggle-on is full color): + * - non-toggle: 1 * color + * - pressed: 0.9 * color + * - toggle-off: 0.8 * color + * - toggle-on: 1.0 * color + * </p> */ public class GLButton extends TexSeqButton { private final GLEventListener glel; @@ -69,8 +76,8 @@ public class GLButton extends TexSeqButton { this.glel = glel; this.useAlpha = useAlpha; - setColor(0.95f, 0.95f, 0.95f, 1.0f); - setPressedColorMod(1f, 1f, 1f, 0.9f); + setColor(1.0f, 1.0f, 1.0f, 1.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 63b0b3eaf..cd919546d 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/ImageButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/ImageButton.java @@ -41,16 +41,24 @@ import com.jogamp.opengl.util.texture.ImageSequence; * This button is rendered with a round oval shape. * To render it rectangular, {@link #setCorner(float)} to zero. * </p> + * <p> + * Default colors (toggle-off is full color): + * - non-toggle: 1 * color + * - pressed: 0.9 * color + * - toggle-off: 1.0 * color + * - toggle-on: 0.8 * color + * </p> */ public class ImageButton extends TexSeqButton { public ImageButton(final int renderModes, final float width, final float height, final ImageSequence texSeq) { super(renderModes, width, height, texSeq); - setColor(0.95f, 0.95f, 0.95f, 1.0f); - setPressedColorMod(1f, 1f, 1f, 0.9f); - setToggleOffColorMod(0.8f, 0.8f, 0.8f, 1.0f); - setToggleOnColorMod(1.0f, 1.0f, 1.0f, 1.0f); + + setColor(1f, 1f, 1f, 1.0f); + setPressedColorMod(0.9f, 0.9f, 0.9f, 0.9f); + setToggleOffColorMod(1f, 1f, 1f, 1f); + setToggleOnColorMod(0.8f, 0.8f, 0.8f, 1f); } public final void setCurrentIdx(final int idx) { 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 55a00aae4..c6a0bf99c 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java @@ -45,6 +45,13 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; * This button is rendered with a round oval shape. * To render it rectangular, {@link #setCorner(float)} to zero. * </p> + * <p> + * Default colors (toggle-on is full color): + * - non-toggle: 1 * color + * - pressed: 0.9 * color + * - toggle-off: 0.8 * color + * - toggle-on: 1.0 * color + * </p> */ public class MediaButton extends TexSeqButton { private boolean verbose = false; @@ -59,8 +66,9 @@ public class MediaButton extends TexSeqButton { public MediaButton(final int renderModes, final float width, final float height, final GLMediaPlayer mPlayer) { super(renderModes, width, height, mPlayer); - setColor(0.8f, 0.8f, 0.8f, 1.0f); - setPressedColorMod(1.1f, 1.1f, 1.1f, 0.7f); + + setColor(1.0f, 1.0f, 1.0f, 1.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); } |