JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
TextRegionUtil.java
Go to the documentation of this file.
1/**
2 * Copyright 2014-2024 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.graph.curve.opengl;
29
30import java.util.ArrayList;
31import java.util.HashMap;
32import java.util.Iterator;
33
34import com.jogamp.opengl.GL2ES2;
35import com.jogamp.opengl.GLException;
36import com.jogamp.graph.curve.OutlineShape;
37import com.jogamp.graph.curve.Region;
38import com.jogamp.graph.font.Font;
39import com.jogamp.graph.font.Font.Glyph;
40import com.jogamp.math.Vec4f;
41import com.jogamp.math.geom.AABBox;
42import com.jogamp.math.geom.plane.AffineTransform;
43
44/**
45 * Text Type Rendering Utility Class adding the {@link Font.Glyph}s {@link OutlineShape} to a {@link GLRegion}.
46 * <p>
47 * {@link OutlineShape}s are all produced in font em-size [0..1].
48 * </p>
49 */
50public class TextRegionUtil {
51
52 public final int renderModes;
53
54 public TextRegionUtil(final int renderModes) {
55 this.renderModes = renderModes;
56 }
57
58 /**
59 * Add the string in 3D space w.r.t. the font in font em-size [0..1] at the end of the {@link GLRegion}
60 * while passing the progressed {@link AffineTransform}.
61 * <p>
62 * The shapes added to the GLRegion are in font em-size [0..1], but can be adjusted with the given transform, progressed and passed to the visitor.
63 * </p>
64 * <p>
65 * Origin of rendered text is 0/0 at bottom left.
66 * </p>
67 * <p>
68 * The region buffer's size is grown by pre-calculating required size via {@link #countStringRegion(Font, CharSequence, int[])}.
69 * </p>
70 * @param region the {@link GLRegion} sink
71 * @param font the target {@link Font}
72 * @param transform optional given transform
73 * @param str string text
74 * @param rgbaColor if {@link Region#hasColorChannel()} RGBA color must be passed, otherwise value is ignored.
75 * @return the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.
76 */
77 public static AABBox addStringToRegion(final Region region, final Font font, final AffineTransform transform,
78 final CharSequence str, final Vec4f rgbaColor) {
79 return addStringToRegion(true /* preGrowRegion */, region, font, transform, str, rgbaColor, new AffineTransform(), new AffineTransform());
80 }
81
82 /**
83 * Add the string in 3D space w.r.t. the font in font em-size [0..1] at the end of the {@link GLRegion}
84 * while passing the progressed {@link AffineTransform}.
85 * <p>
86 * The shapes added to the GLRegion are in font em-size [0..1], but can be adjusted with the given transform, progressed and passed to the visitor.
87 * </p>
88 * <p>
89 * Origin of rendered text is 0/0 at bottom left.
90 * </p>
91 * <p>
92 * The region buffer's size is grown by pre-calculating required size via {@link #countStringRegion(Font, CharSequence, int[])}.
93 * </p>
94 * @param region the {@link GLRegion} sink
95 * @param font the target {@link Font}
96 * @param transform optional given transform
97 * @param str string text
98 * @param rgbaColor if {@link Region#hasColorChannel()} RGBA color must be passed, otherwise value is ignored.
99 * @param temp1 temporary AffineTransform storage, mandatory
100 * @param temp2 temporary AffineTransform storage, mandatory
101 * @return the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.
102 */
103 public static AABBox addStringToRegion(final Region region, final Font font, final AffineTransform transform,
104 final CharSequence str, final Vec4f rgbaColor,
105 final AffineTransform temp1, final AffineTransform temp2) {
106 return addStringToRegion(true /* preGrowRegion */, region, font, transform, str, rgbaColor, temp1, temp2);
107 }
108
109 /**
110 * Add the string in 3D space w.r.t. the font in font em-size [0..1] at the end of the {@link GLRegion}
111 * while passing the progressed {@link AffineTransform}.
112 * <p>
113 * The shapes added to the GLRegion are in font em-size [0..1], but can be adjusted with the given transform, progressed and passed to the visitor.
114 * </p>
115 * <p>
116 * Origin of rendered text is 0/0 at bottom left.
117 * </p>
118 * <p>
119 * Depending on `preGrowRegion`, the region buffer's size is grown by pre-calculating required size via {@link #countStringRegion(Font, CharSequence, int[])}.
120 * </p>
121 * @param preGrowRegion if true, utilizes {@link #countStringRegion(Font, CharSequence, int[])} to pre-calc required buffer size, otherwise not.
122 * @param region the {@link GLRegion} sink
123 * @param font the target {@link Font}
124 * @param transform optional given transform
125 * @param str string text
126 * @param rgbaColor if {@link Region#hasColorChannel()} RGBA color must be passed, otherwise value is ignored.
127 * @param temp1 temporary AffineTransform storage, mandatory
128 * @param temp2 temporary AffineTransform storage, mandatory
129 * @return the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.
130 */
131 public static AABBox addStringToRegion(final boolean preGrowRegion, final Region region, final Font font, final AffineTransform transform,
132 final CharSequence str, final Vec4f rgbaColor,
133 final AffineTransform temp1, final AffineTransform temp2) {
134 final Font.GlyphVisitor visitor = new Font.GlyphVisitor() {
135 @Override
136 public void visit(final Glyph glyph, final AffineTransform t) {
137 if( !glyph.isNonContour() ) {
138 region.addOutlineShape(glyph.getShape(), t, rgbaColor);
139 }
140 }
141 };
142 if( preGrowRegion ) {
143 final int[] vertIndCount = countStringRegion(font, str, new int[2]);
144 region.growBuffer(vertIndCount[0], vertIndCount[1]);
145 }
146 return font.processString(visitor, transform, str, temp1, temp2);
147 }
148
149 /**
150 * Count required number of vertices and indices adding to given int[2] `vertIndexCount` array.
151 * <p>
152 * The region's buffer can be either set using {@link Region#setBufferCapacity(int, int)} or grown using {@link Region#growBuffer(int, int)}.
153 * </p>
154 * @param font the target {@link Font}
155 * @param str string text
156 * @param vertIndexCount the int[2] storage where the counted vertices and indices are added, vertices at [0] and indices at [1]
157 * @return the given int[2] storage for chaining
158 * @see Region#setBufferCapacity(int, int)
159 * @see Region#growBuffer(int, int)
160 * @see #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)
161 */
162 public static int[] countStringRegion(final Font font, final CharSequence str, final int[/*2*/] vertIndexCount) {
163 final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
164 @Override
165 public final void visit(final Font.Glyph glyph) {
166 if( !glyph.isNonContour() ) {
167 Region.countOutlineShape(glyph.getShape(), vertIndexCount);
168 }
169 } };
170 font.processString(visitor, str);
171 return vertIndexCount;
172 }
173
174 /**
175 * Render the string in 3D space w.r.t. the font int font em-size [0..1] at the end of an internally cached {@link GLRegion}.
176 * <p>
177 * The shapes added to the GLRegion are in font em-size [0..1].
178 * </p>
179 * <p>
180 * Origin of rendered text is 0/0 at bottom left.
181 * </p>
182 * <p>
183 * Cached {@link GLRegion}s will be destroyed w/ {@link #clear(GL2ES2)} or to free memory.
184 * </p>
185 * <p>
186 * The region's buffer size is pre-calculated via {@link GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)}
187 * </p>
188 * @param gl the current GL state
189 * @param renderer TODO
190 * @param font {@link Font} to be used
191 * @param str text to be rendered
192 * @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
193 * and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
194 * Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
195 * @return the bounding box of the given string from the produced and rendered GLRegion
196 * @throws Exception if TextRenderer not initialized
197 */
198 public AABBox drawString3D(final GL2ES2 gl, final RegionRenderer renderer,
199 final Font font, final CharSequence str, final Vec4f rgbaColor) {
200 if( !renderer.isInitialized() ) {
201 throw new GLException("TextRendererImpl01: not initialized!");
202 }
203 GLRegion region = getCachedRegion(font, str);
204 AABBox res;
205 if(null == region) {
206 region = GLRegion.create(gl.getGLProfile(), renderModes, null, font, str);
207 res = addStringToRegion(false /* preGrowRegion */, region, font, null, str, rgbaColor, tempT1, tempT2);
208 addCachedRegion(gl, font, str, region);
209 } else {
210 res = new AABBox();
211 res.copy(region.getBounds());
212 }
213 if( !region.hasColorChannel() ) {
214 if( null != rgbaColor ) {
215 renderer.setColorStatic(rgbaColor);
216 }
217 } else {
218 renderer.setColorStatic(1, 1, 1, 1);
219 }
220 region.draw(gl, renderer);
221 return res;
222 }
223
224 /**
225 * Try using {@link #drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
226 * <p>
227 * The region's buffer size is pre-calculated via {@link GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)}
228 * </p>
229 */
230 public static AABBox drawString3D(final GL2ES2 gl, final int renderModes, final RegionRenderer renderer,
231 final Font font, final CharSequence str, final Vec4f rgbaColor) {
232 return drawString3D(gl, renderModes, renderer, font, str, rgbaColor, new AffineTransform(), new AffineTransform());
233 }
234
235 /**
236 * Render the string in 3D space w.r.t. the font in font em-size [0..1] at the end of an internally temporary {@link GLRegion}.
237 * <p>
238 * The shapes added to the GLRegion are in font em-size [0..1].
239 * </p>
240 * <p>
241 * Origin of rendered text is 0/0 at bottom left.
242 * </p>
243 * <p>
244 * The region's buffer size is pre-calculated via {@link GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)}
245 * </p>
246 * <p>
247 * In case of a multisampling region renderer, i.e. {@link Region#VBAA_RENDERING_BIT}, recreating the {@link GLRegion}
248 * is a huge performance impact.
249 * In such case better use {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)}
250 * instead.
251 * </p>
252 * @param gl the current GL state
253 * @param renderModes TODO
254 * @param font {@link Font} to be used
255 * @param str text to be rendered
256 * @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
257 * and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
258 * Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
259 * @param tmp1 temp {@link AffineTransform} to be reused
260 * @param tmp2 temp {@link AffineTransform} to be reused
261 * @throws Exception if TextRenderer not initialized
262 * @return the bounding box of the given string from the produced and rendered GLRegion
263 */
264 public static AABBox drawString3D(final GL2ES2 gl, final int renderModes, final RegionRenderer renderer,
265 final Font font, final CharSequence str, final Vec4f rgbaColor,
266 final AffineTransform tmp1, final AffineTransform tmp2) {
267 if(!renderer.isInitialized()){
268 throw new GLException("TextRendererImpl01: not initialized!");
269 }
270 final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null, font, str);
271 final AABBox res = addStringToRegion(false /* preGrowRegion */, region, font, null, str, rgbaColor, tmp1, tmp2);
272 if( !region.hasColorChannel() ) {
273 if( null != rgbaColor ) {
274 renderer.setColorStatic(rgbaColor);
275 }
276 } else {
277 renderer.setColorStatic(1, 1, 1, 1);
278 }
279 region.draw(gl, renderer);
280 region.destroy(gl);
281 return res;
282 }
283
284 /**
285 * Try using {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
286 * <p>
287 * The region buffer's size is grown by pre-calculating required size via {@link #countStringRegion(Font, CharSequence, int[])}.
288 * </p>
289 */
290 public static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer,
291 final Font font, final CharSequence str, final Vec4f rgbaColor) {
292 return drawString3D(gl, region, renderer, font, str, rgbaColor, new AffineTransform(), new AffineTransform());
293 }
294
295 /**
296 * Render the string in 3D space w.r.t. the font in font em-size [0..1] at the end of the given {@link GLRegion}.
297 * <p>
298 * User might want to {@link GLRegion#clear(GL2ES2)} the region before calling this method.
299 * </p>
300 * <p>
301 * The shapes added to the GLRegion are in font em-size [0..1].
302 * </p>
303 * <p>
304 * Origin of rendered text is 0/0 at bottom left.
305 * </p>
306 * <p>
307 * The region buffer's size is grown by pre-calculating required size via {@link #countStringRegion(Font, CharSequence, int[])}.
308 * </p>
309 * @param gl the current GL state
310 * @param region
311 * @param renderer
312 * @param font {@link Font} to be used
313 * @param str text to be rendered
314 * @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
315 * and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
316 * Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
317 * @param tmp1 temp {@link AffineTransform} to be reused
318 * @param tmp2 temp {@link AffineTransform} to be reused
319 * @return the bounding box of the given string from the produced and rendered GLRegion
320 * @throws Exception if TextRenderer not initialized
321 */
322 public static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer,
323 final Font font, final CharSequence str, final Vec4f rgbaColor,
324 final AffineTransform tmp1, final AffineTransform tmp2) {
325 if(!renderer.isInitialized()){
326 throw new GLException("TextRendererImpl01: not initialized!");
327 }
328 final AABBox res = addStringToRegion(true /* preGrowRegion */, region, font, null, str, rgbaColor, tmp1, tmp2);
329 if( !region.hasColorChannel() ) {
330 if( null != rgbaColor ) {
331 renderer.setColorStatic(rgbaColor);
332 }
333 } else {
334 renderer.setColorStatic(1, 1, 1, 1);
335 }
336 region.draw(gl, renderer);
337 return res;
338 }
339
340 /**
341 * Clear all cached {@link GLRegions} and mapped values.
342 */
343 public void clear(final GL2ES2 gl) {
344 // fluchCache(gl) already called
345 final Iterator<GLRegion> iterator = stringCacheMap.values().iterator();
346 while(iterator.hasNext()){
347 final GLRegion region = iterator.next();
348 region.destroy(gl);
349 }
350 stringCacheMap.clear();
351 stringCacheArray.clear();
352 }
353
354 /**
355 * <p>Sets the cache limit for reusing GlyphString's and their Region.
356 * Default is {@link #DEFAULT_CACHE_LIMIT}, -1 unlimited, 0 turns cache off, >0 limited </p>
357 *
358 * <p>The cache will be validate when the next string rendering happens.</p>
359 *
360 * @param newLimit new cache size
361 *
362 * @see #DEFAULT_CACHE_LIMIT
363 */
364 public final void setCacheLimit(final int newLimit ) { stringCacheLimit = newLimit; }
365
366 /**
367 * Sets the cache limit, see {@link #setCacheLimit(int)} and validates the cache.
368 *
369 * @see #setCacheLimit(int)
370 *
371 * @param gl current GL used to remove cached objects if required
372 * @param newLimit new cache size
373 */
374 public final void setCacheLimit(final GL2ES2 gl, final int newLimit ) { stringCacheLimit = newLimit; validateCache(gl, 0); }
375
376 /**
377 * @return the current cache limit
378 */
379 public final int getCacheLimit() { return stringCacheLimit; }
380
381 /**
382 * @return the current utilized cache size, <= {@link #getCacheLimit()}
383 */
384 public final int getCacheSize() { return stringCacheArray.size(); }
385
386 private final void validateCache(final GL2ES2 gl, final int space) {
387 if ( getCacheLimit() > 0 ) {
388 while ( getCacheSize() + space > getCacheLimit() ) {
389 removeCachedRegion(gl, 0);
390 }
391 }
392 }
393
394 private final GLRegion getCachedRegion(final Font font, final CharSequence str) {
395 return stringCacheMap.get(new Key(font, str));
396 }
397
398 private final void addCachedRegion(final GL2ES2 gl, final Font font, final CharSequence str, final GLRegion glyphString) {
399 if ( 0 != getCacheLimit() ) {
400 final Key key = new Key(font, str);
401 final GLRegion oldRegion = stringCacheMap.put(key, glyphString);
402 if ( null == oldRegion ) {
403 // new entry ..
404 validateCache(gl, 1);
405 stringCacheArray.add(stringCacheArray.size(), key);
406 } /// else overwrite is nop ..
407 }
408 }
409
410 private final void removeCachedRegion(final GL2ES2 gl, final Font font, final CharSequence str) {
411 final Key key = new Key(font, str);
412 final GLRegion region = stringCacheMap.remove(key);
413 if(null != region) {
414 region.destroy(gl);
415 }
416 stringCacheArray.remove(key);
417 }
418
419 private final void removeCachedRegion(final GL2ES2 gl, final int idx) {
420 final Key key = stringCacheArray.remove(idx);
421 if( null != key ) {
422 final GLRegion region = stringCacheMap.remove(key);
423 if(null != region) {
424 region.destroy(gl);
425 }
426 }
427 }
428
429 private class Key {
430 private final String fontName;
431 private final CharSequence text;
432 public final int hash;
433
434 public Key(final Font font, final CharSequence text) {
435 this.fontName = font.getName(Font.NAME_UNIQUNAME);
436 this.text = text;
437
438 // 31 * x == (x << 5) - x
439 final int lhash = 31 + fontName.hashCode();
440 this.hash = ((lhash << 5) - lhash) + text.hashCode();
441 }
442
443 @Override
444 public final int hashCode() { return hash; }
445
446 @Override
447 public final boolean equals(final Object o) {
448 if( this == o ) { return true; }
449 if( o instanceof Key ) {
450 final Key ok = (Key)o;
451 return ok.fontName.equals(fontName) && ok.text.equals(text);
452 }
453 return false;
454 }
455 }
456
457 /** Default cache limit, see {@link #setCacheLimit(int)} */
458 public static final int DEFAULT_CACHE_LIMIT = 256;
459
462 private final HashMap<Key, GLRegion> stringCacheMap = new HashMap<Key, GLRegion>(DEFAULT_CACHE_LIMIT);
463 private final ArrayList<Key> stringCacheArray = new ArrayList<Key>(DEFAULT_CACHE_LIMIT);
464 private int stringCacheLimit = DEFAULT_CACHE_LIMIT;
465}
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
Definition: Region.java:62
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
static final int[] countOutlineShape(final OutlineShape shape, final int[] vertIndexCount)
Count required number of vertices and indices adding to given int[2] vertIndexCount array.
Definition: Region.java:572
static boolean hasColorChannel(final int renderModes)
Returns true if render mode has a color channel, i.e.
Definition: Region.java:231
final AABBox getBounds()
Definition: Region.java:783
abstract boolean growBuffer(int verticesCount, int indicesCount)
Increase the renderer buffers if necessary to add given counts of vertices- and index elements.
A GLRegion is the OGL binding of one or more OutlineShapes Defined by its vertices and generated tria...
Definition: GLRegion.java:70
final void destroy(final GL2ES2 gl)
Delete and clear the associated OGL objects.
Definition: GLRegion.java:460
final void draw(final GL2ES2 gl, final RegionRenderer renderer)
Renders the associated OGL objects specifying current width/hight of window for optional multi pass r...
Definition: GLRegion.java:518
static GLRegion create(final GLProfile glp, int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit, final int initialVerticesCount, final int initialIndicesCount)
Create a GLRegion using the passed render mode.
Definition: GLRegion.java:109
final void setColorStatic(final Vec4f rgbaColor)
Text Type Rendering Utility Class adding the Font.Glyphs OutlineShape to a GLRegion.
AABBox drawString3D(final GL2ES2 gl, final RegionRenderer renderer, final Font font, final CharSequence str, final Vec4f rgbaColor)
Render the string in 3D space w.r.t.
static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer, final Font font, final CharSequence str, final Vec4f rgbaColor)
Try using drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f,...
static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer, final Font font, final CharSequence str, final Vec4f rgbaColor, final AffineTransform tmp1, final AffineTransform tmp2)
Render the string in 3D space w.r.t.
final void setCacheLimit(final GL2ES2 gl, final int newLimit)
Sets the cache limit, see setCacheLimit(int) and validates the cache.
static int[] countStringRegion(final Font font, final CharSequence str, final int[] vertIndexCount)
Count required number of vertices and indices adding to given int[2] vertIndexCount array.
static final int DEFAULT_CACHE_LIMIT
Default cache limit, see setCacheLimit(int).
static AABBox drawString3D(final GL2ES2 gl, final int renderModes, final RegionRenderer renderer, final Font font, final CharSequence str, final Vec4f rgbaColor, final AffineTransform tmp1, final AffineTransform tmp2)
Render the string in 3D space w.r.t.
static AABBox addStringToRegion(final Region region, final Font font, final AffineTransform transform, final CharSequence str, final Vec4f rgbaColor)
Add the string in 3D space w.r.t.
final void setCacheLimit(final int newLimit)
static AABBox addStringToRegion(final boolean preGrowRegion, final Region region, final Font font, final AffineTransform transform, final CharSequence str, final Vec4f rgbaColor, final AffineTransform temp1, final AffineTransform temp2)
Add the string in 3D space w.r.t.
void clear(final GL2ES2 gl)
Clear all cached GLRegions and mapped values.
static AABBox addStringToRegion(final Region region, final Font font, final AffineTransform transform, final CharSequence str, final Vec4f rgbaColor, final AffineTransform temp1, final AffineTransform temp2)
Add the string in 3D space w.r.t.
static AABBox drawString3D(final GL2ES2 gl, final int renderModes, final RegionRenderer renderer, final Font font, final CharSequence str, final Vec4f rgbaColor)
Try using drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform,...
4D Vector based upon four float components.
Definition: Vec4f.java:37
Axis Aligned Bounding Box.
Definition: AABBox.java:54
final AABBox copy(final AABBox src)
Copy given AABBox 'src' values to this AABBox.
Definition: AABBox.java:158
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
General purpose Font.Glyph visitor w/o AffineTransform.
Definition: Font.java:310
General purpose Font.Glyph visitor.
Definition: Font.java:298
boolean isNonContour()
Returns true if isWhitespace() or isUndefined().
Interface wrapper for font implementation.
Definition: Font.java:60
AABBox processString(final Font.GlyphVisitor visitor, final AffineTransform transform, final CharSequence string)
Try using processString(GlyphVisitor, AffineTransform, CharSequence, AffineTransform,...
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.