diff options
author | Sven Gothel <[email protected]> | 2023-02-17 12:17:57 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-02-17 12:17:57 +0100 |
commit | e72dbd286ba95913711ac812bc979204f2073b7c (patch) | |
tree | 46aa57a2bd1f87a3c9b0fdaea834a388833525e6 /src/test/com/jogamp | |
parent | 4aca9d8252afbdc9e7dfd234c086f889623bb140 (diff) |
Graph: Fix Loop.initFromPolyline()'s Winding determination, document Winding rules for OutlineShape and add get/setWinding in Outline
Loop.initFromPolyline()'s Winding determination used a 3-point triangle-area method,
which is insufficent for complex shapes like serif 'g' or 'æ'.
Solved by using the whole area over the Outline shape.
Note: Loop.initFromPolyline()'s Winding determination is used to convert
the inner shape or holes to CW only.
Therefor the outter bondary shapes must be CCW.
This details has been documented within OutlineShape, anchor 'windingrules'.
Since the conversion of 'CCW -> CW' for inner shapes or holes is covered,
a safe user path would be to completely create CCW shapes.
However, this has not been hardcoded and is left to the user.
Impact: Fixes rendering serif 'g' or 'æ'.
The enhanced unit test TestTextRendererNEWT01 produces snapshots for all fonts within FontSet01.
While it shows proper rendering of the single Glyphs it exposes another Region/Curve Renderer bug,
i.e. sort-of a Region overflow crossing over from the box-end to the start.
Diffstat (limited to 'src/test/com/jogamp')
5 files changed, 403 insertions, 43 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index 8826275b1..52ca9041b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -48,6 +48,7 @@ import org.junit.runners.MethodSorters; import com.jogamp.common.os.Platform; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; import com.jogamp.graph.geom.SVertex; @@ -142,51 +143,87 @@ public class TestTextRendererNEWT01 extends UITestCase { final Runnable action_per_font = new Runnable() { @Override public void run() { + if( false ) { + textGLListener.setHeadBox(1, false); + textGLListener.setSampleCount(2); + window.display(); + textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); + sleep(); + + textGLListener.setHeadBox(2, false); + textGLListener.setSampleCount(2); + window.display(); + textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); + sleep(); + } + textGLListener.setHeadBox(1, false); - textGLListener.setSampleCount(2); + textGLListener.setSampleCount(4); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); textGLListener.setHeadBox(2, false); - textGLListener.setSampleCount(2); + textGLListener.setSampleCount(4); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); + } }; - textGLListener.setHeadBox(1, false); - textGLListener.setSampleCount(3); - window.display(); - textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); - sleep(); + final Font[] fonts = FontSet01.getSet01(); + for(final Font f : fonts) { + if( textGLListener.setFont(f) ) { + action_per_font.run(); + } + } + if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { + action_per_font.run(); + } + destroyWindow(window); + } - textGLListener.setHeadBox(2, false); - textGLListener.setSampleCount(3); - window.display(); - textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); - sleep(); + @Test + public void testTextRendererMSAA01() throws InterruptedException, GLException, IOException { + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities caps = new GLCapabilities(glp); + caps.setAlphaBits(4); + caps.setSampleBuffers(true); + caps.setNumSamples(4); + System.err.println("Requested: "+caps); + + final GLWindow window = createWindow("text-vbaa0-msaa1", caps, 1024, 640); + window.display(); + System.err.println("Chosen: "+window.getChosenGLCapabilities()); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final TextGLListener textGLListener = new TextGLListener(rs, 0, 0 /* sampleCount */, DEBUG, TRACE); + textGLListener.attachInputListenerTo(window); + window.addGLEventListener(textGLListener); + textGLListener.setHeadBox(2, true); + window.display(); + + final Runnable action_per_font = new Runnable() { + @Override + public void run() { textGLListener.setHeadBox(1, false); - textGLListener.setSampleCount(4); + textGLListener.setSampleCount(0); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); textGLListener.setHeadBox(2, false); - textGLListener.setSampleCount(4); + textGLListener.setSampleCount(0); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); } }; - if(textGLListener.setFontSet(FontFactory.UBUNTU, FontSet.FAMILY_LIGHT, FontSet.STYLE_NONE)) { - action_per_font.run(); - } - - if(textGLListener.setFontSet(FontFactory.UBUNTU, FontSet.FAMILY_REGULAR, FontSet.STYLE_NONE)) { - action_per_font.run(); + final Font[] fonts = FontSet01.getSet01(); + for(final Font f : fonts) { + if( textGLListener.setFont(f) ) { + action_per_font.run(); + } } - if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { action_per_font.run(); } @@ -195,15 +232,13 @@ public class TestTextRendererNEWT01 extends UITestCase { } @Test - public void testTextRendererMSAA01() throws InterruptedException, GLException, IOException { + public void testTextRendererNoSampling() throws InterruptedException, GLException, IOException { final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); - caps.setSampleBuffers(true); - caps.setNumSamples(4); System.err.println("Requested: "+caps); - final GLWindow window = createWindow("text-vbaa0-msaa1", caps, 1024, 640); + final GLWindow window = createWindow("text-vbaa0-msaa0", caps, 1024, 640); window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); @@ -230,14 +265,12 @@ public class TestTextRendererNEWT01 extends UITestCase { sleep(); } }; - if(textGLListener.setFontSet(FontFactory.UBUNTU, FontSet.FAMILY_LIGHT, FontSet.STYLE_NONE)) { - action_per_font.run(); - } - - if(textGLListener.setFontSet(FontFactory.UBUNTU, FontSet.FAMILY_REGULAR, FontSet.STYLE_NONE)) { - action_per_font.run(); + final Font[] fonts = FontSet01.getSet01(); + for(final Font f : fonts) { + if( textGLListener.setFont(f) ) { + action_per_font.run(); + } } - if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { action_per_font.run(); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index b86cc60aa..7b1fe6177 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -34,7 +34,6 @@ import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLAnimatorControl; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLException; -import com.jogamp.opengl.GLRunnable; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; @@ -46,7 +45,6 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.font.Font.Glyph; import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.KeyListener; @@ -114,21 +112,21 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin. Quisque sit amet neque lorem, \n" + "-------Press H to change text---------"; - public static final String textX2 = // Kvæven -> Kvaven (error) + public static final String textX2 = "I “Ask Jeff” or ‘Ask Jeff’. Take the chef d’œuvre! Two of [of] (of) ‘of’ “of” of? of! of*. X\n"+ "Les Woëvres, the Fôret de Wœvres, the Voire and Vauvise. Yves is in heaven; D’Amboise is in jail. X\n"+ "Lyford’s in Texas & L’Anse-aux-Griffons in Québec; the Łyna in Poland. Yriarte, Yciar and Ysaÿe are at Yale. X\n"+ - "Kyoto and Ryotsu are both in Japan, Kwikpak on the Yukon delta, Kvaven in Norway, Kyulu in Kenya, not in Rwanda.… X\n"+ + "Kyoto and Ryotsu are both in Japan, Kwikpak on the Yukon delta, Kvæven in Norway, Kyulu in Kenya, not in Rwanda.… X\n"+ "Von-Vincke-Straße in Münster, Vdovino in Russia, Ytterbium in the periodic table. Are Toussaint L’Ouverture, Wölfflin, Wolfe, X\n"+ "Miłosz and Wū Wŭ all in the library? 1510–1620, 11:00 pm, and the 1980s are over. X\n"+ "-------Press H to change text---------"; - public static final String textX20 = // Kvæven -> Kvaven (error) + public static final String textX20 = "I “Ask Jeff” or ‘Ask Jeff’. Take the chef d’œuvre! Two of [of] (of) ‘of’ “of” of? of! of*.\n"+ "Two of [of] (of) ‘of’ “of” of? of! of*. Ydes, Yffignac and Ygrande are in France: so are Ypres,\n"+ "Les Woëvres, the Fôret de Wœvres, the Voire and Vauvise. Yves is in heaven; D’Amboise is in jail.\n"+ "Lyford’s in Texas & L’Anse-aux-Griffons in Québec; the Łyna in Poland. Yriarte, Yciar and Ysaÿe are at Yale.\n"+ - "Kyoto and Ryotsu are both in Japan, Kwikpak on the Yukon delta, Kvaven in Norway, Kyulu in Kenya, not in Rwanda.…\n"+ + "Kyoto and Ryotsu are both in Japan, Kwikpak on the Yukon delta, Kvæven in Norway, Kyulu in Kenya, not in Rwanda.…\n"+ "Walton’s in West Virginia, but «Wren» is in Oregon. Tlálpan is near Xochimilco in México.\n"+ "The Zygos & Xylophagou are in Cyprus, Zwettl in Austria, Fænø in Denmark, the Vøringsfossen and Værøy in Norway.\n"+ "Tchula is in Mississippi, the Tittabawassee in Michigan. Twodot is here in Montana, Ywamun in Burma.\n"+ @@ -448,6 +446,17 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB return false; } + public boolean setFont(final Font _font) { + if(null != _font) { + // fontSet = ??? + font = _font; + fontName = font.getFullFamilyName()+" (head "+fontSizeHead+"pt)"; + fontNameBox = font.getMetricBounds(fontName); + return true; + } + return false; + } + public boolean isUserInputMode() { return userInput; } void dumpMatrix(final boolean bbox) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java index c3df7c7ed..d2bff1fee 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java @@ -33,6 +33,7 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.geom.plane.Winding; /** * GPU based resolution independent test object @@ -51,13 +52,17 @@ public class TestObject01 extends UIShape { protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { } + @SuppressWarnings("unused") @Override protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); // lower case 'o' // Start TTF Shape for Glyph 82 - if( true ) { + if( false ) { + // Original Outer shape: Winding.CW + // Moved into OutlineShape reverse -> Winding.CCW -> OK + // // Shape.MoveTo: shape.closeLastOutline(false); shape.addEmptyOutline(); @@ -126,8 +131,12 @@ public class TestObject01 extends UIShape { // Shape.QuadTo: shape.addVertex(0, 0.527000f, 0.319000f, false); shape.addVertex(0, 0.527000f, 0.258000f, true); + System.err.println("TestObject01.shape01a.winding_area: "+shape.getWindingOfLastOutline()); shape.closeLastOutline(false); } else { + // Outer shape: Winding.CW + // Moved into OutlineShape same-order -> Winding.CW -> ERROR (so we fix it in the end, see below) + // // Shape.MoveTo: shape.closeLastOutline(false); shape.addEmptyOutline(); @@ -196,10 +205,16 @@ public class TestObject01 extends UIShape { // Shape.QuadTo: shape.addVertex(0.527000f, 0.319000f, false); shape.addVertex(0.527000f, 0.258000f, true); + System.err.println("TestObject01.shape01b.1.winding_area: "+shape.getWindingOfLastOutline()); + shape.setWindingOfLastOutline(Winding.CCW); + System.err.println("TestObject01.shape01b.2.winding_area: "+shape.getWindingOfLastOutline()); shape.closeLastOutline(false); } - if( false ) { + if( true ) { + // Original Inner shape: Winding.CCW + // Moved into OutlineShape reverse -> Winding.CW -> OK + // // Shape.MoveTo: shape.closeLastOutline(false); shape.addEmptyOutline(); @@ -236,8 +251,12 @@ public class TestObject01 extends UIShape { // Shape.QuadTo: shape.addVertex(0, 0.458000f, 0.161000f, false); shape.addVertex(0, 0.458000f, 0.258000f, true); + System.err.println("TestObject01.shape02a.winding_area: "+shape.getWindingOfLastOutline()); shape.closeLastOutline(false); } else { + // Inner shape: Winding.CCW + // Moved into OutlineShape same-order -> Winding.CCW -> OK + // // Shape.MoveTo: shape.closeLastOutline(false); shape.addEmptyOutline(); @@ -276,6 +295,7 @@ public class TestObject01 extends UIShape { shape.addVertex(0.458000f, 0.161000f, false); shape.addVertex(0.458000f, 0.258000f, true); + System.err.println("TestObject01.shape02b.winding_area: "+shape.getWindingOfLastOutline()); shape.closeLastOutline(false); } // End Shape for Glyph 82 diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java index 34aec67c3..fe1d965ee 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java @@ -51,6 +51,7 @@ public class TestObject02 extends UIShape { protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { } + @SuppressWarnings("unused") @Override protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); @@ -58,7 +59,10 @@ public class TestObject02 extends UIShape { // lower case 'æ' // Start TTF Shape for Glyph 193 - { + if( true ) { + // Original Inner e-shape: Winding.CCW + // Moved into OutlineShape reverse -> Winding.CW -> OK + // // Shape.MoveTo: shape.closeLastOutline(false); shape.addEmptyOutline(); @@ -90,10 +94,51 @@ public class TestObject02 extends UIShape { // 008: B1: line-to p0-p1 // Shape.LineTo: shape.addVertex(0, 0.728000f, 0.300000f, true); + System.err.println("TestObject02.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Inner e-shape: Winding.CCW + // Moved into OutlineShape same-order -> Winding.CCW -> ?? + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0.728000f, 0.300000f, true); + // 000: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.726000f, 0.381000f, false); + shape.addVertex(0.690000f, 0.426000f, true); + // 002: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.654000f, 0.471000f, false); + shape.addVertex(0.588000f, 0.471000f, true); + // 003: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.553000f, 0.471000f, false); + shape.addVertex(0.526000f, 0.457000f, true); + // 005: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.498000f, 0.443000f, false); + shape.addVertex(0.478000f, 0.420000f, true); + // 006: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.457000f, 0.396000f, false); + shape.addVertex(0.446000f, 0.365000f, true); + // 007: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.434000f, 0.334000f, false); + shape.addVertex(0.432000f, 0.300000f, true); + // 008: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.728000f, 0.300000f, true); + System.err.println("TestObject02.shape01b.winding_area: "+shape.getWindingOfLastOutline()); shape.closeLastOutline(false); } - { + if( true ) { + // Original Outer shape: Winding.CW + // Moved into OutlineShape reverse -> Winding.CCW -> OK + // // Shape.MoveTo: shape.closeLastOutline(false); shape.addEmptyOutline(); @@ -270,10 +315,196 @@ public class TestObject02 extends UIShape { // Shape.QuadTo: shape.addVertex(0, 0.289000f, -0.011000f, false); shape.addVertex(0, 0.252000f, -0.011000f, true); + System.err.println("TestObject02.shape02a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Outer shape: Winding.CW + // Moved into OutlineShape same-order -> Winding.CW -> OK now + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0.252000f, -0.011000f, true); + // 009: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.208000f, -0.011000f, false); + shape.addVertex(0.171000f, -0.002000f, true); + // 011: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.133000f, 0.007000f, false); + shape.addVertex(0.106000f, 0.026000f, true); + // 012: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.079000f, 0.046000f, false); + shape.addVertex(0.064000f, 0.076000f, true); + // 013: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.048000f, 0.107000f, false); + shape.addVertex(0.048000f, 0.151000f, true); + // 014: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.048000f, 0.193000f, false); + shape.addVertex(0.064000f, 0.223000f, true); + // 016: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.080000f, 0.253000f, false); + shape.addVertex(0.109000f, 0.272000f, true); + // 017: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.138000f, 0.292000f, false); + shape.addVertex(0.178000f, 0.301000f, true); + // 018: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.218000f, 0.310000f, false); + shape.addVertex(0.265000f, 0.310000f, true); + // 019: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.279000f, 0.310000f, false); + shape.addVertex(0.294000f, 0.309000f, true); + // 021: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.310000f, 0.307000f, false); + shape.addVertex(0.324000f, 0.305000f, true); + // 022: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.339000f, 0.302000f, false); + shape.addVertex(0.349000f, 0.300000f, true); + // 023: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.360000f, 0.297000f, false); + shape.addVertex(0.364000f, 0.295000f, true); + // 024: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.364000f, 0.327000f, true); + // 025: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.364000f, 0.354000f, false); + shape.addVertex(0.360000f, 0.379000f, true); + // 027: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.356000f, 0.405000f, false); + shape.addVertex(0.343000f, 0.425000f, true); + // 028: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.329000f, 0.446000f, false); + shape.addVertex(0.305000f, 0.458000f, true); + // 029: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.280000f, 0.471000f, false); + shape.addVertex(0.240000f, 0.471000f, true); + // 030: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.186000f, 0.471000f, false); + shape.addVertex(0.156000f, 0.464000f, true); + // 032: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.126000f, 0.456000f, false); + shape.addVertex(0.113000f, 0.451000f, true); + // 033: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.105000f, 0.507000f, true); + // 034: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.122000f, 0.515000f, false); + shape.addVertex(0.158000f, 0.522000f, true); + // 036: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.194000f, 0.529000f, false); + shape.addVertex(0.243000f, 0.529000f, true); + // 037: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.314000f, 0.529000f, false); + shape.addVertex(0.354000f, 0.503000f, true); + // 039: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.395000f, 0.476000f, false); + shape.addVertex(0.412000f, 0.431000f, true); + // 040: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.445000f, 0.480000f, false); + shape.addVertex(0.491000f, 0.504000f, true); + // 042: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.537000f, 0.529000f, false); + shape.addVertex(0.587000f, 0.529000f, true); + // 043: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.682000f, 0.529000f, false); + shape.addVertex(0.738000f, 0.467000f, true); + // 045: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.795000f, 0.405000f, false); + shape.addVertex(0.795000f, 0.276000f, true); + // 046: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.795000f, 0.268000f, false); + shape.addVertex(0.795000f, 0.260000f, true); + // 048: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.794000f, 0.252000f, false); + shape.addVertex(0.793000f, 0.245000f, true); + // 049: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.430000f, 0.245000f, true); + // 050: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.433000f, 0.150000f, false); + shape.addVertex(0.477000f, 0.099000f, true); + // 052: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.521000f, 0.048000f, false); + shape.addVertex(0.617000f, 0.048000f, true); + // 053: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.670000f, 0.048000f, false); + shape.addVertex(0.701000f, 0.058000f, true); + // 055: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.732000f, 0.068000f, false); + shape.addVertex(0.746000f, 0.075000f, true); + // 056: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.758000f, 0.019000f, true); + // 057: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.744000f, 0.011000f, false); + shape.addVertex(0.706000f, 0.000000f, true); + // 059: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.667000f, -0.011000f, false); + shape.addVertex(0.615000f, -0.011000f, true); + // 060: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.558000f, -0.011000f, false); + shape.addVertex(0.514000f, 0.003000f, true); + // 062: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.470000f, 0.017000f, false); + shape.addVertex(0.437000f, 0.049000f, true); + // 063: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.426000f, 0.040000f, false); + shape.addVertex(0.410000f, 0.030000f, true); + // 065: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.393000f, 0.019000f, false); + shape.addVertex(0.370000f, 0.010000f, true); + // 066: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.347000f, 0.001000f, false); + shape.addVertex(0.318000f, -0.005000f, true); + // 067: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.289000f, -0.011000f, false); + shape.addVertex(0.252000f, -0.011000f, true); + System.err.println("TestObject02.shape02b.winding_area: "+shape.getWindingOfLastOutline()); shape.closeLastOutline(false); } if( true ) { + // Original Inner a-shape: Winding.CCW + // Moved into OutlineShape reverse -> Winding.CW -> OK now + // // Shape.MoveTo: shape.closeLastOutline(false); shape.addEmptyOutline(); @@ -334,6 +565,73 @@ public class TestObject02 extends UIShape { // Shape.QuadTo: shape.addVertex(0, 0.366000f, 0.190000f, false); shape.addVertex(0, 0.365000f, 0.238000f, true); + System.err.println("TestObject02.shape03a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Inner a-shape: Winding.CCW + // Moved into OutlineShape same-order -> Winding.CCW -> OK + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0.365000f, 0.238000f, true); + // 068: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.354000f, 0.243000f, false); + shape.addVertex(0.330000f, 0.248000f, true); + // 070: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.305000f, 0.254000f, false); + shape.addVertex(0.263000f, 0.254000f, true); + // 071: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.239000f, 0.254000f, false); + shape.addVertex(0.213000f, 0.251000f, true); + // 073: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.187000f, 0.247000f, false); + shape.addVertex(0.165000f, 0.236000f, true); + // 074: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.143000f, 0.224000f, false); + shape.addVertex(0.129000f, 0.204000f, true); + // 075: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.115000f, 0.184000f, false); + shape.addVertex(0.115000f, 0.151000f, true); + // 076: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.115000f, 0.122000f, false); + shape.addVertex(0.125000f, 0.102000f, true); + // 078: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.135000f, 0.082000f, false); + shape.addVertex(0.153000f, 0.070000f, true); + // 079: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.172000f, 0.058000f, false); + shape.addVertex(0.197000f, 0.053000f, true); + // 080: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.222000f, 0.047000f, false); + shape.addVertex(0.252000f, 0.047000f, true); + // 081: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.314000f, 0.047000f, false); + shape.addVertex(0.350000f, 0.063000f, true); + // 083: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.386000f, 0.080000f, false); + shape.addVertex(0.400000f, 0.093000f, true); + // 084: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.384000f, 0.119000f, false); + shape.addVertex(0.375000f, 0.154000f, true); + // 086: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.366000f, 0.190000f, false); + shape.addVertex(0.365000f, 0.238000f, true); + System.err.println("TestObject02.shape03b.winding_area: "+shape.getWindingOfLastOutline()); shape.closeLastOutline(false); } // End Shape for Glyph 193 diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java index 0fe9b300e..b3a56d9b7 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java @@ -204,7 +204,7 @@ public class UITypeDemo01 implements GLEventListener { } else { final float scale = 0.15312886f; final float size_xz = 0.541f; - final UIShape o = new TestObject01(SVertex.factory(), renderModes); + final UIShape o = new TestObject02(SVertex.factory(), renderModes); o.scale(scale, scale, 1f); // o.translate(size_xz, -size_xz, 0f); testObj = o; |