JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
Glyph01UbuntuLight_o.java
Go to the documentation of this file.
1/**
2 * Copyright 2023 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.demos.graph.ui.testshapes;
29
30import com.jogamp.graph.curve.OutlineShape;
31import com.jogamp.graph.ui.GraphShape;
32import com.jogamp.math.geom.plane.Winding;
33import com.jogamp.opengl.GL2ES2;
34import com.jogamp.opengl.GLProfile;
35
36/**
37 * GPU based resolution independent test object
38 * - Ubuntu-Light, lower case 'o'
39 * - TTF Shape for Glyph 82
40 */
41public class Glyph01UbuntuLight_o extends GraphShape {
42
44 super(renderModes);
45 }
46
47 @SuppressWarnings("unused")
48 @Override
49 protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
50 final OutlineShape shape = new OutlineShape();
51
52 // Ubuntu-Light, lower case 'o'
53 // Start TTF Shape for Glyph 82
54 if( false ) {
55 // Original Outer shape: Winding.CW
56 // Moved into OutlineShape reverse -> Winding.CCW -> OK
57 //
58 // Shape.MoveTo:
59 shape.closeLastOutline(false);
60 shape.addEmptyOutline();
61 shape.addVertex(0, 0.527000f, 0.258000f, true);
62 // 000: B4: quad-to p0-p1-p2h **** MID
63 // Shape.QuadTo:
64 shape.addVertex(0, 0.527000f, 0.197000f, false);
65 shape.addVertex(0, 0.510000f, 0.147000f, true);
66 // 002: B5: quad-to pMh-p0-p1h ***** MID
67 // Shape.QuadTo:
68 shape.addVertex(0, 0.492000f, 0.097000f, false);
69 shape.addVertex(0, 0.461000f, 0.062000f, true);
70 // 003: B5: quad-to pMh-p0-p1h ***** MID
71 // Shape.QuadTo:
72 shape.addVertex(0, 0.429000f, 0.027000f, false);
73 shape.addVertex(0, 0.386000f, 0.008000f, true);
74 // 004: B6: quad-to pMh-p0-p1
75 // Shape.QuadTo:
76 shape.addVertex(0, 0.343000f, -0.012000f, false);
77 shape.addVertex(0, 0.291000f, -0.012000f, true);
78 // 005: B4: quad-to p0-p1-p2h **** MID
79 // Shape.QuadTo:
80 shape.addVertex(0, 0.239000f, -0.012000f, false);
81 shape.addVertex(0, 0.196000f, 0.007000f, true);
82 // 007: B5: quad-to pMh-p0-p1h ***** MID
83 // Shape.QuadTo:
84 shape.addVertex(0, 0.153000f, 0.027000f, false);
85 shape.addVertex(0, 0.122000f, 0.062000f, true);
86 // 008: B5: quad-to pMh-p0-p1h ***** MID
87 // Shape.QuadTo:
88 shape.addVertex(0, 0.090000f, 0.097000f, false);
89 shape.addVertex(0, 0.073000f, 0.147000f, true);
90 // 009: B6: quad-to pMh-p0-p1
91 // Shape.QuadTo:
92 shape.addVertex(0, 0.055000f, 0.197000f, false);
93 shape.addVertex(0, 0.055000f, 0.258000f, true);
94 // 010: B4: quad-to p0-p1-p2h **** MID
95 // Shape.QuadTo:
96 shape.addVertex(0, 0.055000f, 0.319000f, false);
97 shape.addVertex(0, 0.072000f, 0.369000f, true);
98 // 012: B5: quad-to pMh-p0-p1h ***** MID
99 // Shape.QuadTo:
100 shape.addVertex(0, 0.090000f, 0.419000f, false);
101 shape.addVertex(0, 0.121000f, 0.454000f, true);
102 // 013: B5: quad-to pMh-p0-p1h ***** MID
103 // Shape.QuadTo:
104 shape.addVertex(0, 0.153000f, 0.490000f, false);
105 shape.addVertex(0, 0.196000f, 0.509000f, true);
106 // 014: B6: quad-to pMh-p0-p1
107 // Shape.QuadTo:
108 shape.addVertex(0, 0.239000f, 0.529000f, false);
109 shape.addVertex(0, 0.291000f, 0.529000f, true);
110 // 015: B4: quad-to p0-p1-p2h **** MID
111 // Shape.QuadTo:
112 shape.addVertex(0, 0.343000f, 0.529000f, false);
113 shape.addVertex(0, 0.386000f, 0.510000f, true);
114 // 017: B5: quad-to pMh-p0-p1h ***** MID
115 // Shape.QuadTo:
116 shape.addVertex(0, 0.429000f, 0.490000f, false);
117 shape.addVertex(0, 0.460000f, 0.455000f, true);
118 // 018: B5: quad-to pMh-p0-p1h ***** MID
119 // Shape.QuadTo:
120 shape.addVertex(0, 0.492000f, 0.419000f, false);
121 shape.addVertex(0, 0.509000f, 0.369000f, true);
122 // 019: B6: quad-to pMh-p0-p1
123 // Shape.QuadTo:
124 shape.addVertex(0, 0.527000f, 0.319000f, false);
125 shape.addVertex(0, 0.527000f, 0.258000f, true);
126 System.err.println("Glyph01UbuntuLight_o.shape01a.winding_area: "+shape.getWindingOfLastOutline());
127 shape.closeLastOutline(false);
128 } else {
129 // Outer shape: Winding.CW
130 // Moved into OutlineShape same-order -> Winding.CW -> ERROR (so we fix it in the end, see below)
131 //
132 // Shape.MoveTo:
133 shape.closeLastOutline(false);
134 shape.addEmptyOutline();
135 shape.addVertex(0.527000f, 0.258000f, true);
136 // 000: B4: quad-to p0-p1-p2h **** MID
137 // Shape.QuadTo:
138 shape.addVertex(0.527000f, 0.197000f, false);
139 shape.addVertex(0.510000f, 0.147000f, true);
140 // 002: B5: quad-to pMh-p0-p1h ***** MID
141 // Shape.QuadTo:
142 shape.addVertex(0.492000f, 0.097000f, false);
143 shape.addVertex(0.461000f, 0.062000f, true);
144 // 003: B5: quad-to pMh-p0-p1h ***** MID
145 // Shape.QuadTo:
146 shape.addVertex(0.429000f, 0.027000f, false);
147 shape.addVertex(0.386000f, 0.008000f, true);
148 // 004: B6: quad-to pMh-p0-p1
149 // Shape.QuadTo:
150 shape.addVertex(0.343000f, -0.012000f, false);
151 shape.addVertex(0.291000f, -0.012000f, true);
152 // 005: B4: quad-to p0-p1-p2h **** MID
153 // Shape.QuadTo:
154 shape.addVertex(0.239000f, -0.012000f, false);
155 shape.addVertex(0.196000f, 0.007000f, true);
156 // 007: B5: quad-to pMh-p0-p1h ***** MID
157 // Shape.QuadTo:
158 shape.addVertex(0.153000f, 0.027000f, false);
159 shape.addVertex(0.122000f, 0.062000f, true);
160 // 008: B5: quad-to pMh-p0-p1h ***** MID
161 // Shape.QuadTo:
162 shape.addVertex(0.090000f, 0.097000f, false);
163 shape.addVertex(0.073000f, 0.147000f, true);
164 // 009: B6: quad-to pMh-p0-p1
165 // Shape.QuadTo:
166 shape.addVertex(0.055000f, 0.197000f, false);
167 shape.addVertex(0.055000f, 0.258000f, true);
168 // 010: B4: quad-to p0-p1-p2h **** MID
169 // Shape.QuadTo:
170 shape.addVertex(0.055000f, 0.319000f, false);
171 shape.addVertex(0.072000f, 0.369000f, true);
172 // 012: B5: quad-to pMh-p0-p1h ***** MID
173 // Shape.QuadTo:
174 shape.addVertex(0.090000f, 0.419000f, false);
175 shape.addVertex(0.121000f, 0.454000f, true);
176 // 013: B5: quad-to pMh-p0-p1h ***** MID
177 // Shape.QuadTo:
178 shape.addVertex(0.153000f, 0.490000f, false);
179 shape.addVertex(0.196000f, 0.509000f, true);
180 // 014: B6: quad-to pMh-p0-p1
181 // Shape.QuadTo:
182 shape.addVertex(0.239000f, 0.529000f, false);
183 shape.addVertex(0.291000f, 0.529000f, true);
184 // 015: B4: quad-to p0-p1-p2h **** MID
185 // Shape.QuadTo:
186 shape.addVertex(0.343000f, 0.529000f, false);
187 shape.addVertex(0.386000f, 0.510000f, true);
188 // 017: B5: quad-to pMh-p0-p1h ***** MID
189 // Shape.QuadTo:
190 shape.addVertex(0.429000f, 0.490000f, false);
191 shape.addVertex(0.460000f, 0.455000f, true);
192 // 018: B5: quad-to pMh-p0-p1h ***** MID
193 // Shape.QuadTo:
194 shape.addVertex(0.492000f, 0.419000f, false);
195 shape.addVertex(0.509000f, 0.369000f, true);
196 // 019: B6: quad-to pMh-p0-p1
197 // Shape.QuadTo:
198 shape.addVertex(0.527000f, 0.319000f, false);
199 shape.addVertex(0.527000f, 0.258000f, true);
200 System.err.println("Glyph01UbuntuLight_o.shape01b.1.winding_area: "+shape.getWindingOfLastOutline());
202 System.err.println("Glyph01UbuntuLight_o.shape01b.2.winding_area: "+shape.getWindingOfLastOutline());
203 shape.closeLastOutline(false);
204 }
205
206 if( true ) {
207 // Original Inner shape: Winding.CCW
208 // Moved into OutlineShape reverse -> Winding.CW -> OK
209 //
210 // Shape.MoveTo:
211 shape.closeLastOutline(false);
212 shape.addEmptyOutline();
213 shape.addVertex(0, 0.458000f, 0.258000f, true);
214 // 020: B4: quad-to p0-p1-p2h **** MID
215 // Shape.QuadTo:
216 shape.addVertex(0, 0.458000f, 0.355000f, false);
217 shape.addVertex(0, 0.413000f, 0.412000f, true);
218 // 022: B6: quad-to pMh-p0-p1
219 // Shape.QuadTo:
220 shape.addVertex(0, 0.368000f, 0.470000f, false);
221 shape.addVertex(0, 0.291000f, 0.470000f, true);
222 // 023: B4: quad-to p0-p1-p2h **** MID
223 // Shape.QuadTo:
224 shape.addVertex(0, 0.214000f, 0.470000f, false);
225 shape.addVertex(0, 0.169000f, 0.413000f, true);
226 // 025: B6: quad-to pMh-p0-p1
227 // Shape.QuadTo:
228 shape.addVertex(0, 0.124000f, 0.355000f, false);
229 shape.addVertex(0, 0.124000f, 0.258000f, true);
230 // 026: B4: quad-to p0-p1-p2h **** MID
231 // Shape.QuadTo:
232 shape.addVertex(0, 0.124000f, 0.161000f, false);
233 shape.addVertex(0, 0.169000f, 0.104000f, true);
234 // 028: B6: quad-to pMh-p0-p1
235 // Shape.QuadTo:
236 shape.addVertex(0, 0.214000f, 0.047000f, false);
237 shape.addVertex(0, 0.291000f, 0.047000f, true);
238 // 029: B4: quad-to p0-p1-p2h **** MID
239 // Shape.QuadTo:
240 shape.addVertex(0, 0.368000f, 0.047000f, false);
241 shape.addVertex(0, 0.413000f, 0.104000f, true);
242 // 031: B6: quad-to pMh-p0-p1
243 // Shape.QuadTo:
244 shape.addVertex(0, 0.458000f, 0.161000f, false);
245 shape.addVertex(0, 0.458000f, 0.258000f, true);
246 System.err.println("Glyph01UbuntuLight_o.shape02a.winding_area: "+shape.getWindingOfLastOutline());
247 shape.closeLastOutline(false);
248 } else {
249 // Inner shape: Winding.CCW
250 // Moved into OutlineShape same-order -> Winding.CCW -> OK
251 //
252 // Shape.MoveTo:
253 shape.closeLastOutline(false);
254 shape.addEmptyOutline();
255
256 shape.addVertex(0.458000f, 0.258000f, true);
257 // 020: B4: quad-to p0-p1-p2h **** MID
258 // Shape.QuadTo:
259 shape.addVertex(0.458000f, 0.355000f, false);
260 shape.addVertex(0.413000f, 0.412000f, true);
261 // 022: B6: quad-to pMh-p0-p1
262 // Shape.QuadTo:
263 shape.addVertex(0.368000f, 0.470000f, false);
264 shape.addVertex(0.291000f, 0.470000f, true);
265 // 023: B4: quad-to p0-p1-p2h **** MID
266 // Shape.QuadTo:
267 shape.addVertex(0.214000f, 0.470000f, false);
268 shape.addVertex(0.169000f, 0.413000f, true);
269 // 025: B6: quad-to pMh-p0-p1
270 // Shape.QuadTo:
271 shape.addVertex(0.124000f, 0.355000f, false);
272 shape.addVertex(0.124000f, 0.258000f, true);
273 // 026: B4: quad-to p0-p1-p2h **** MID
274 // Shape.QuadTo:
275 shape.addVertex(0.124000f, 0.161000f, false);
276 shape.addVertex(0.169000f, 0.104000f, true);
277 // 028: B6: quad-to pMh-p0-p1
278 // Shape.QuadTo:
279 shape.addVertex(0.214000f, 0.047000f, false);
280 shape.addVertex(0.291000f, 0.047000f, true);
281 // 029: B4: quad-to p0-p1-p2h **** MID
282 // Shape.QuadTo:
283 shape.addVertex(0.368000f, 0.047000f, false);
284 shape.addVertex(0.413000f, 0.104000f, true);
285 // 031: B6: quad-to pMh-p0-p1
286 // Shape.QuadTo:
287 shape.addVertex(0.458000f, 0.161000f, false);
288 shape.addVertex(0.458000f, 0.258000f, true);
289
290 System.err.println("Glyph01UbuntuLight_o.shape02b.winding_area: "+shape.getWindingOfLastOutline());
291 shape.closeLastOutline(false);
292 }
293 // End Shape for Glyph 82
294
295 shape.setIsQuadraticNurbs();
297
298 resetGLRegion(glp, gl, null, shape);
299 region.addOutlineShape(shape, null, rgbaColor);
300 box.resize(shape.getBounds());
302 }
303
304 @Override
305 public String getSubString() {
306 return super.getSubString();
307 }
308}
A Generic shape objects which is defined by a list of Outlines.
final Winding getWindingOfLastOutline()
Compute the Winding of the getLastOutline() using the VectorUtil#area(ArrayList) function over all of...
final void addVertex(final Vertex v)
Adds a vertex to the last open outline to the shape's tail.
final void setIsQuadraticNurbs()
Claim this outline's vertices are all OutlineShape.VerticesState#QUADRATIC_NURBS, hence no cubic tran...
final void setSharpness(final float s)
Sets sharpness, defaults to DEFAULT_SHARPNESS.
final void closeLastOutline(final boolean closeTail)
Closes the last outline in the shape.
final void addEmptyOutline()
Add a new empty Outline to the end of this shape's outline list.
final void setWindingOfLastOutline(final Winding enforced)
Sets the enforced Winding of the getLastOutline().
final void addOutlineShape(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor)
Add the given OutlineShape to this region with the given optional AffineTransform.
Definition: Region.java:616
Graph based GLRegion Shape.
Definition: GraphShape.java:55
final void resetGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, int vertexCount, int indexCount)
Reset the GLRegion and reserving its buffers to have a free capacity for vertexCount and indexCount e...
final Vec4f rgbaColor
Default base-color w/o color channel, will be modulated w/ pressed- and toggle color.
Definition: Shape.java:261
final Shape setRotationPivot(final float px, final float py, final float pz)
Set unscaled rotation origin, aka pivot.
Definition: Shape.java:620
final AABBox resize(final AABBox newBox)
Resize the AABBox to encapsulate another AABox.
Definition: AABBox.java:274
final Vec3f getCenter()
Returns computed center of this AABBox of getLow() and getHigh().
Definition: AABBox.java:737
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
Winding direction, either clockwise (CW) or counter-clockwise (CCW).
Definition: Winding.java:6
CCW
Counter-Clockwise (CCW) positive winding direction.
Definition: Winding.java:10