aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-01 11:36:27 +0200
committerSven Gothel <[email protected]>2023-09-01 11:36:27 +0200
commit5d83a6271495fe43141ee2c7f301f16ea0389134 (patch)
tree7c4acd21008ddf02c7bf27ff78189e39fc6ad364
parent35746b3a618d94b03fc1ab465114d4d97540f45d (diff)
GraphUI Demo: Rename UISceneDemoU01a -> UIGraphDemoU01a, not using GraphUI's Scene but manual GLEventListener etc, add a few Glyph tests
-rw-r--r--make/scripts/tests.sh2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java (renamed from src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java)28
2 files changed, 25 insertions, 5 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 724e4b818..572bb8f01 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -1005,7 +1005,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $*
#testawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $*
#testawt com.jogamp.opengl.demos.es2.GearsES2 $*
-#testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemoU01a $*
+#testnoawt com.jogamp.opengl.demos.graph.ui.UIGraphDemoU01a $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UILayoutGrid01 $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UILayoutBox01 $*
testnoawt com.jogamp.opengl.demos.graph.ui.FontView01 $*
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
index c5ba2e918..e9779eb29 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
@@ -34,6 +34,7 @@ import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.TextRegionUtil;
import com.jogamp.graph.font.Font;
+import com.jogamp.graph.font.Font.Glyph;
import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.font.FontSet;
import com.jogamp.graph.geom.plane.AffineTransform;
@@ -90,7 +91,7 @@ import com.jogamp.opengl.util.PMVMatrix;
* Note: Reshape won't adjust and this is merely to demonstrate the coordinate space.
* </p>
*/
-public class UISceneDemoU01a {
+public class UIGraphDemoU01a {
static final CommandlineOptions options = new CommandlineOptions(1280, 720, Region.VBAA_RENDERING_BIT );
static final Vec4f text_color = new Vec4f( 0, 1, 0, 1 );
static Font font;
@@ -151,14 +152,14 @@ public class UISceneDemoU01a {
final GLWindow window = GLWindow.create(caps);
window.setSize(options.surface_width, options.surface_height);
- window.setTitle(UISceneDemoU01a.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
+ window.setTitle(UIGraphDemoU01a.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.setVisible(true);
System.out.println("Chosen: " + window.getChosenGLCapabilities());
window.addGLEventListener(renderer);
window.addWindowListener(new WindowAdapter() {
@Override
public void windowResized(final WindowEvent e) {
- window.setTitle(UISceneDemoU01a.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
+ window.setTitle(UIGraphDemoU01a.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
}
@Override
public void windowDestroyNotify(final WindowEvent e) {
@@ -309,7 +310,7 @@ public class UISceneDemoU01a {
renderer.enable(gl, true);
{
pmv.glPushMatrix();
- drawText(gl, pmv, "Hello JogAmp Users!");
+ drawText(gl, pmv, " Hello JogAmp Users!");
pmv.glPopMatrix();
}
if( !textOnly ) {
@@ -352,6 +353,25 @@ public class UISceneDemoU01a {
System.err.println("XXX: txt_box_r "+txt_box_r);
final AABBox textPort = txt_box_r.mapToWindow(new AABBox(), pmv.getPMvMat(), renderer.getViewport(), true /* useCenterZ */);
System.err.println("Display.1: Shape TextPort "+textPort);
+
+ final Font.GlyphVisitor visitor = new Font.GlyphVisitor() {
+ int idx = 0;
+ @Override
+ public void visit(final char symbol, final Glyph glyph, final AffineTransform t) {
+ System.err.println("idx["+idx+"]: "+glyph);
+ ++idx;
+ }
+ };
+ final AABBox txt_box_r2 = font.processString(visitor, null, text, new AffineTransform(), new AffineTransform());
+ System.err.println("XXX: txt_box_r2 "+txt_box_r2);
+ {
+ final Glyph g = font.getGlyph( font.getGlyphID(' '));
+ System.err.println("XXX: space "+g);
+ }
+ {
+ final Glyph g = font.getGlyph( font.getGlyphID('\t'));
+ System.err.println("XXX: tab "+g);
+ }
}
}
private boolean onceAtDisplay = true;