aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-04-09 16:41:17 +0200
committerSven Gothel <[email protected]>2014-04-09 16:41:17 +0200
commit1c4a353b7edbbc03440197db3c2dabfc37f8010d (patch)
tree56af894e1f49cf2ab651f42e8c05d9a044e29ab6
parent11021769c78343b842b723a432a08946a65a1ceb (diff)
Bug 801: LabelButton uses DEFAULT_2PASS_LABEL_ZOFFSET in any mode, due to disabled depth buffer in blend mode
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java37
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java22
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java2
3 files changed, 23 insertions, 38 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
index 211e4c387..2dcad1e86 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
@@ -162,7 +162,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
}
}
- private void initButtons(final GL2ES2 gl, final int width, final int height, final float labelZOffset, final RegionRenderer renderer) {
+ private void initButtons(final GL2ES2 gl, final int width, final int height, final RegionRenderer renderer) {
final boolean pass2Mode = Region.isTwoPass( renderModes ) ;
buttons.clear();
@@ -174,7 +174,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
final float diffX = 1.2f * buttonXSize;
final float diffY = 1.5f * buttonYSize;
- LabelButton button = new LabelButton(SVertex.factory(), renderModes, font, "Next Text", buttonXSize, buttonYSize, labelZOffset);
+ LabelButton button = new LabelButton(SVertex.factory(), renderModes, font, "Next Text", buttonXSize, buttonYSize);
button.translate(xstart,ystart-diffY*buttons.size(), 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -190,7 +190,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
button.addMouseListener(dragZoomRotateListener);
buttons.add(button);
- button = new LabelButton(SVertex.factory(), renderModes, font, "Show FPS", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "Show FPS", buttonXSize, buttonYSize);
button.setName(100); // FIXME: DEBUG tag
button.translate(xstart,ystart - diffY*buttons.size(), 0f);
button.setToggleable(true);
@@ -207,7 +207,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
button.addMouseListener(dragZoomRotateListener);
buttons.add(button);
- button = new LabelButton(SVertex.factory(), renderModes, font, "v-sync", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "v-sync", buttonXSize, buttonYSize);
button.translate(xstart,ystart - diffY*buttons.size(), 0f);
button.setToggleable(true);
button.setToggle(gl.getSwapInterval()>0);
@@ -230,7 +230,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
button.addMouseListener(dragZoomRotateListener);
buttons.add(button);
- button = new LabelButton(SVertex.factory(), renderModes, font, "< tilt >", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "< tilt >", buttonXSize, buttonYSize);
button.translate(xstart,ystart - diffY*buttons.size(), 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -252,7 +252,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
if( pass2Mode ) { // second column to the left
- button = new LabelButton(SVertex.factory(), renderModes, font, "< samples >", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "< samples >", buttonXSize, buttonYSize);
button.translate(xstart,ystart - diffY*buttons.size(), 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -278,7 +278,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
button.addMouseListener(dragZoomRotateListener);
buttons.add(button);
- button = new LabelButton(SVertex.factory(), renderModes, font, "< quality >", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "< quality >", buttonXSize, buttonYSize);
button.translate(xstart,ystart - diffY*buttons.size(), 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -306,7 +306,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
}
- button = new LabelButton(SVertex.factory(), renderModes, font, "Quit", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "Quit", buttonXSize, buttonYSize);
button.translate(xstart,ystart - diffY*buttons.size(), 0f);
button.setColor(0.7f, 0.0f, 0.0f, 1.0f);
button.setLabelColor(1.2f, 1.2f, 1.2f);
@@ -332,7 +332,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
{
int j = 1; // column
int k = 0; // row
- button = new LabelButton(SVertex.factory(), renderModes, font, "y flip", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "y flip", buttonXSize, buttonYSize);
button.translate(xstart - diffX*j,ystart - diffY*k, 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -343,7 +343,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
k++;
- button = new LabelButton(SVertex.factory(), renderModes, font, "x flip", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "x flip", buttonXSize, buttonYSize);
button.translate(xstart - diffX*j,ystart - diffY*k, 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -354,7 +354,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
k++;
- button = new LabelButton(SVertex.factory(), renderModes, font, "+", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "+", buttonXSize, buttonYSize);
button.translate(xstart - diffX*j,ystart - diffY*k, 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -381,7 +381,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
k++;
- button = new LabelButton(SVertex.factory(), renderModes, font, "< space >", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "< space >", buttonXSize, buttonYSize);
button.translate(xstart - diffX*j,ystart - diffY*k, 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -405,7 +405,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
k++;
- button = new LabelButton(SVertex.factory(), renderModes, font, "< corner >", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "< corner >", buttonXSize, buttonYSize);
button.translate(xstart - diffX*j,ystart - diffY*k, 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -430,7 +430,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
k++;
- button = new LabelButton(SVertex.factory(), renderModes, font, "reset", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "reset", buttonXSize, buttonYSize);
button.translate(xstart - diffX*j,ystart - diffY*k, 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -441,7 +441,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
buttons.add(button);
k++;
- button = new LabelButton(SVertex.factory(), renderModes, font, "screenshot", buttonXSize, buttonYSize, labelZOffset);
+ button = new LabelButton(SVertex.factory(), renderModes, font, "screenshot", buttonXSize, buttonYSize);
button.translate(xstart - diffX*j,ystart - diffY*k, 0f);
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
@@ -621,11 +621,6 @@ public class GPUUISceneGLListener0A implements GLEventListener {
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
gl.glEnable(GL2ES2.GL_BLEND);
- final int zBits = drawable.getChosenGLCapabilities().getDepthBits();
- final float zEpsilon = FloatUtil.getZBufferEpsilon(zBits, sceneDist, zNear);
- final float labelZOffset = Region.isTwoPass(renderModes) ? LabelButton.DEFAULT_2PASS_LABEL_ZOFFSET : -2f*zEpsilon;
- System.err.println("zEpsilon "+zEpsilon+" ( zBits "+zBits+") -> labelZOffset "+labelZOffset);
-
renderer.init(gl, renderModes);
initTexts();
@@ -664,7 +659,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
crossHairCtr.setEnabled(true);
crossHairCtr.translate(0f, 0f, -1f);
- initButtons(gl, drawable.getWidth(), drawable.getHeight(), labelZOffset, renderer);
+ initButtons(gl, drawable.getWidth(), drawable.getHeight(), renderer);
for(int i=0; i<buttons.size(); i++) {
sceneUIController.addShape(buttons.get(i));
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java
index 90237f56c..0ac728e50 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java
@@ -45,19 +45,18 @@ public class LabelButton extends RoundButton {
public static final float DEFAULT_SPACING_X = 0.08f;
/** {@value} */
public static final float DEFAULT_SPACING_Y = 0.40f;
- public static final float DEFAULT_2PASS_LABEL_ZOFFSET = -0.05f;
- private float labelZOffset;
+ private static final float DEFAULT_2PASS_LABEL_ZOFFSET = -0.05f;
+
private final Label0 label;
private float spacingX = DEFAULT_SPACING_X;
private float spacingY = DEFAULT_SPACING_Y;
public LabelButton(final Factory<? extends Vertex> factory, final int renderModes,
final Font labelFont, final String labelText,
- final float width, final float height, final float labelZOffset) {
+ final float width, final float height) {
super(factory, renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height);
this.label = new Label0(labelFont, labelText, new float[] { 1.33f, 1.33f, 1.33f, 1.0f }); // 0.75 * 1.33 = 1.0
- this.labelZOffset = labelZOffset;
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);
@@ -81,9 +80,9 @@ public class LabelButton extends RoundButton {
protected void addShapeToRegion(GL2ES2 gl, RegionRenderer renderer) {
final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory());
if(corner == 0.0f) {
- createSharpOutline(shape, labelZOffset);
+ createSharpOutline(shape, DEFAULT_2PASS_LABEL_ZOFFSET);
} else {
- createCurvedOutline(shape, labelZOffset);
+ createCurvedOutline(shape, DEFAULT_2PASS_LABEL_ZOFFSET);
}
shape.setIsQuadraticNurbs();
shape.setSharpness(shapesSharpness);
@@ -126,14 +125,6 @@ public class LabelButton extends RoundButton {
}
}
- public final float getLabelZOffset() {
- return labelZOffset;
- }
-
- public final void setLabelZOffset(final float labelZOffset) {
- this.labelZOffset = labelZOffset;
- markShapeDirty();
- }
public final float getSpacingX() { return spacingX; }
public final float getSpacingY() { return spacingY; }
@@ -177,7 +168,6 @@ public class LabelButton extends RoundButton {
@Override
public String getSubString() {
- return super.getSubString()+", "+ label + ", " + "spacing: " + spacingX+"/"+spacingY+
- ", labelZOffset " + labelZOffset;
+ return super.getSubString()+", "+ label + ", " + "spacing: " + spacingX+"/"+spacingY;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java
index d019e696e..0844d1f02 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java
@@ -50,7 +50,7 @@ public class UIGLListener01 extends UIListenerBase01 {
setMatrix(-20, 00, 0f, -50);
try {
final Font font = FontFactory.get(FontFactory.UBUNTU).getDefault();
- button = new LabelButton(SVertex.factory(), 0, font, "Click me!", 4f, 3f, -0.05f);
+ button = new LabelButton(SVertex.factory(), 0, font, "Click me!", 4f, 3f);
button.translate(2,1,0);
/** Button defaults !
button.setLabelColor(1.0f,1.0f,1.0f);