aboutsummaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-02-13 22:19:05 +0100
committerSven Göthel <[email protected]>2024-02-13 22:19:05 +0100
commit101ec44f9d6df7faa0695accccfd43f51e48e7a4 (patch)
tree77a0b4dcc3fe74c91189fffe4c41a5c81e3ce2d7 /src/demos
parent65b3a230a53252f7c2cacd968b7afee6d43e7327 (diff)
Bug 1501: Graph RenderState add debug-bits, i.e. DEBUG_LINESTRIP used in VBORegionSPES2 to just render lines instead of the filled area -> Used in UIShapeDemo02a
Diffstat (limited to 'src/demos')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo02a.java26
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java4
2 files changed, 23 insertions, 7 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo02a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo02a.java
index 69bd9b000..7d2369217 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo02a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo02a.java
@@ -31,11 +31,16 @@ import java.io.IOException;
import com.jogamp.common.util.InterruptSource;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.GLRegion;
+import com.jogamp.graph.curve.opengl.RegionRenderer;
+import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.ui.GraphShape;
import com.jogamp.graph.ui.Scene;
+import com.jogamp.graph.ui.Shape;
import com.jogamp.graph.ui.shapes.Rectangle;
import com.jogamp.math.Recti;
import com.jogamp.math.Vec3f;
+import com.jogamp.math.Vec4f;
import com.jogamp.math.geom.AABBox;
import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.newt.event.KeyAdapter;
@@ -44,7 +49,10 @@ import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLEventAdapter;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.demos.graph.ui.testshapes.Glyph03FreeMonoRegular_M;
import com.jogamp.opengl.demos.util.CommandlineOptions;
@@ -112,11 +120,23 @@ public class UIShapeDemo02a {
final Rectangle rectShape;
if( use_glyph ) {
testShape = new Glyph03FreeMonoRegular_M(options.renderModes);
+ testShape.setColor(0.8f, 0.8f, 0.8f, 1);
testShape.scale(1000, 1000, 1);
rectShape = null;
+ testShape.onDraw((final Shape s, final GL2ES2 gl, final RegionRenderer renderer) -> {
+ final GLRegion region = ((GraphShape)s).getRegion();
+ renderer.getRenderState().setDebugBits(RenderState.DEBUG_LINESTRIP);
+ renderer.setColorStatic(new Vec4f(0, 0, 1, 1));
+ region.draw(gl, renderer);
+ renderer.getRenderState().clearDebugBits(RenderState.DEBUG_LINESTRIP);
+ return false;
+ });
+ scene.addShape(testShape);
} else {
testShape = null;
rectShape = new Rectangle(options.renderModes, 1, 1, 0);
+ rectShape.setColor(0, 0, 1, 1);
+ scene.addShape(rectShape);
}
scene.attachInputListenerTo(window);
@@ -141,9 +161,6 @@ public class UIShapeDemo02a {
scene.waitUntilDisplayed();
final AABBox sbox = scene.getBounds();
System.err.println("Scene "+sbox);
- if( null != testShape ) {
- scene.addShape(testShape);;
- }
if( null != rectShape ) {
final float sw = sbox.getWidth();
final float sh = sbox.getHeight();
@@ -156,8 +173,6 @@ public class UIShapeDemo02a {
w2 = w-14*delta;
}
rectShape.setDimension(w2, h, lineWidth);
- rectShape.setColor(0, 0, 1, 1);
- scene.addShape(rectShape);
System.err.printf("R_0: w %30.30f x %30.30f%n", w2, h);
Thread.sleep(500);
if( false ) {
@@ -172,6 +187,7 @@ public class UIShapeDemo02a {
}
}
}
+ scene.screenshot(true, scene.nextScreenshotFile(null, UIShapeDemo02a.class.getSimpleName(), options.renderModes, reqCaps, null));
}
private static final class MyMatrixSetup implements Scene.PMVMatrixSetup {
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java
index deb53380b..665b3e82b 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java
@@ -48,7 +48,7 @@ public class Glyph03FreeMonoRegular_M extends GraphShape {
protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
final OutlineShape shape = new OutlineShape();
- if( false ) {
+ if( true ) {
// Start TTF Shape for Glyph 48
// GlyphShape<48>: offset 0 of 45/45 points
// pM[044] P[483/522, on true, end true]
@@ -622,7 +622,7 @@ public class Glyph03FreeMonoRegular_M extends GraphShape {
shape.closeLastOutline(false);
} else {
final boolean with_left_leg = true; // ERROR
- final boolean with_right_leg = false; // OK
+ final boolean with_right_leg = true; // OK
// Start TTF Shape for Glyph 48
// GlyphShape<48>: offset 0 of 45/45 points