JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.graph.curve.opengl.TextRegionUtil Class Reference

Text Type Rendering Utility Class adding the Font.Glyphs OutlineShape to a GLRegion. More...

Collaboration diagram for com.jogamp.graph.curve.opengl.TextRegionUtil:

Public Member Functions

 TextRegionUtil (final int renderModes)
 
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. More...
 
void clear (final GL2ES2 gl)
 Clear all cached GLRegions and mapped values. More...
 
final void setCacheLimit (final int newLimit)
 
final void setCacheLimit (final GL2ES2 gl, final int newLimit)
 Sets the cache limit, see setCacheLimit(int) and validates the cache. More...
 
final int getCacheLimit ()
 
final int getCacheSize ()
 

Static Public Member Functions

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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, AffineTransform) to reuse AffineTransform instances. More...
 
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. More...
 
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, AffineTransform, AffineTransform) to reuse AffineTransform instances. More...
 
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. More...
 

Public Attributes

final int renderModes
 
final AffineTransform tempT1 = new AffineTransform()
 
final AffineTransform tempT2 = new AffineTransform()
 

Static Public Attributes

static final int DEFAULT_CACHE_LIMIT = 256
 Default cache limit, see setCacheLimit(int). More...
 

Detailed Description

Text Type Rendering Utility Class adding the Font.Glyphs OutlineShape to a GLRegion.

OutlineShapes are all produced in font em-size [0..1].

Definition at line 50 of file TextRegionUtil.java.

Constructor & Destructor Documentation

◆ TextRegionUtil()

com.jogamp.graph.curve.opengl.TextRegionUtil.TextRegionUtil ( final int  renderModes)

Definition at line 54 of file TextRegionUtil.java.

Member Function Documentation

◆ addStringToRegion() [1/3]

static AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.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 
)
static

Add the string in 3D space w.r.t.

the font in font em-size [0..1] at the end of the GLRegion while passing the progressed AffineTransform.

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.

Origin of rendered text is 0/0 at bottom left.

Depending on preGrowRegion, the region buffer's size is grown by pre-calculating required size via countStringRegion(Font, CharSequence, int[]).

Parameters
preGrowRegionif true, utilizes countStringRegion(Font, CharSequence, int[]) to pre-calc required buffer size, otherwise not.
regionthe GLRegion sink
fontthe target Font
transformoptional given transform
strstring text
rgbaColorif Region#hasColorChannel() RGBA color must be passed, otherwise value is ignored.
temp1temporary AffineTransform storage, mandatory
temp2temporary AffineTransform storage, mandatory
Returns
the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.

Definition at line 131 of file TextRegionUtil.java.

Here is the call graph for this function:

◆ addStringToRegion() [2/3]

static AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.addStringToRegion ( final Region  region,
final Font  font,
final AffineTransform  transform,
final CharSequence  str,
final Vec4f  rgbaColor 
)
static

Add the string in 3D space w.r.t.

the font in font em-size [0..1] at the end of the GLRegion while passing the progressed AffineTransform.

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.

Origin of rendered text is 0/0 at bottom left.

The region buffer's size is grown by pre-calculating required size via countStringRegion(Font, CharSequence, int[]).

Parameters
regionthe GLRegion sink
fontthe target Font
transformoptional given transform
strstring text
rgbaColorif Region#hasColorChannel() RGBA color must be passed, otherwise value is ignored.
Returns
the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.

Definition at line 77 of file TextRegionUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addStringToRegion() [3/3]

static AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.addStringToRegion ( final Region  region,
final Font  font,
final AffineTransform  transform,
final CharSequence  str,
final Vec4f  rgbaColor,
final AffineTransform  temp1,
final AffineTransform  temp2 
)
static

Add the string in 3D space w.r.t.

the font in font em-size [0..1] at the end of the GLRegion while passing the progressed AffineTransform.

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.

Origin of rendered text is 0/0 at bottom left.

The region buffer's size is grown by pre-calculating required size via countStringRegion(Font, CharSequence, int[]).

Parameters
regionthe GLRegion sink
fontthe target Font
transformoptional given transform
strstring text
rgbaColorif Region#hasColorChannel() RGBA color must be passed, otherwise value is ignored.
temp1temporary AffineTransform storage, mandatory
temp2temporary AffineTransform storage, mandatory
Returns
the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.

Definition at line 103 of file TextRegionUtil.java.

Here is the call graph for this function:

◆ clear()

void com.jogamp.graph.curve.opengl.TextRegionUtil.clear ( final GL2ES2  gl)

Clear all cached GLRegions and mapped values.

Definition at line 343 of file TextRegionUtil.java.

Here is the call graph for this function:

◆ countStringRegion()

static int[] com.jogamp.graph.curve.opengl.TextRegionUtil.countStringRegion ( final Font  font,
final CharSequence  str,
final int[]  vertIndexCount 
)
static

Count required number of vertices and indices adding to given int[2] vertIndexCount array.

The region's buffer can be either set using Region#setBufferCapacity(int, int) or grown using Region#growBuffer(int, int).

Parameters
fontthe target Font
strstring text
vertIndexCountthe int[2] storage where the counted vertices and indices are added, vertices at [0] and indices at [1]
Returns
the given int[2] storage for chaining
See also
Region::setBufferCapacity(int, int)
Region::growBuffer(int, int)
drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform)

Definition at line 162 of file TextRegionUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawString3D() [1/5]

static AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.drawString3D ( final GL2ES2  gl,
final GLRegion  region,
final RegionRenderer  renderer,
final Font  font,
final CharSequence  str,
final Vec4f  rgbaColor 
)
static

Try using drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform) to reuse AffineTransform instances.

The region buffer's size is grown by pre-calculating required size via countStringRegion(Font, CharSequence, int[]).

Definition at line 290 of file TextRegionUtil.java.

Here is the call graph for this function:

◆ drawString3D() [2/5]

static AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.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 
)
static

Render the string in 3D space w.r.t.

the font in font em-size [0..1] at the end of the given GLRegion.

User might want to GLRegion#clear(GL2ES2) the region before calling this method.

The shapes added to the GLRegion are in font em-size [0..1].

Origin of rendered text is 0/0 at bottom left.

The region buffer's size is grown by pre-calculating required size via countStringRegion(Font, CharSequence, int[]).

Parameters
glthe current GL state
region
renderer
fontFont to be used
strtext to be rendered
rgbaColorused to fill the region's color-channel if used and set renderer's static-color to white. Otherwise used to set the renderer's static-color only, if not null.
tmp1temp AffineTransform to be reused
tmp2temp AffineTransform to be reused
Returns
the bounding box of the given string from the produced and rendered GLRegion
Exceptions
Exceptionif TextRenderer not initialized

Definition at line 322 of file TextRegionUtil.java.

Here is the call graph for this function:

◆ drawString3D() [3/5]

static AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.drawString3D ( final GL2ES2  gl,
final int  renderModes,
final RegionRenderer  renderer,
final Font  font,
final CharSequence  str,
final Vec4f  rgbaColor 
)
static

Try using drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform) to reuse AffineTransform instances.

The region's buffer size is pre-calculated via GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)

Definition at line 230 of file TextRegionUtil.java.

Here is the call graph for this function:

◆ drawString3D() [4/5]

static AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.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 
)
static

Render the string in 3D space w.r.t.

the font in font em-size [0..1] at the end of an internally temporary GLRegion.

The shapes added to the GLRegion are in font em-size [0..1].

Origin of rendered text is 0/0 at bottom left.

The region's buffer size is pre-calculated via GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)

In case of a multisampling region renderer, i.e. Region#VBAA_RENDERING_BIT, recreating the GLRegion is a huge performance impact. In such case better use drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, AffineTransform, AffineTransform) instead.

Parameters
glthe current GL state
renderModesTODO
fontFont to be used
strtext to be rendered
rgbaColorused to fill the region's color-channel if used and set renderer's static-color to white. Otherwise used to set the renderer's static-color only, if not null.
tmp1temp AffineTransform to be reused
tmp2temp AffineTransform to be reused
Exceptions
Exceptionif TextRenderer not initialized
Returns
the bounding box of the given string from the produced and rendered GLRegion

Definition at line 264 of file TextRegionUtil.java.

Here is the call graph for this function:

◆ drawString3D() [5/5]

AABBox com.jogamp.graph.curve.opengl.TextRegionUtil.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.

the font int font em-size [0..1] at the end of an internally cached GLRegion.

The shapes added to the GLRegion are in font em-size [0..1].

Origin of rendered text is 0/0 at bottom left.

Cached GLRegions will be destroyed w/ clear(GL2ES2) or to free memory.

The region's buffer size is pre-calculated via GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)

Parameters
glthe current GL state
rendererTODO
fontFont to be used
strtext to be rendered
rgbaColorused to fill the region's color-channel if used and set renderer's static-color to white. Otherwise used to set the renderer's static-color only, if not null.
Returns
the bounding box of the given string from the produced and rendered GLRegion
Exceptions
Exceptionif TextRenderer not initialized

Definition at line 198 of file TextRegionUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCacheLimit()

final int com.jogamp.graph.curve.opengl.TextRegionUtil.getCacheLimit ( )
Returns
the current cache limit

Definition at line 379 of file TextRegionUtil.java.

◆ getCacheSize()

final int com.jogamp.graph.curve.opengl.TextRegionUtil.getCacheSize ( )
Returns
the current utilized cache size, <= getCacheLimit()

Definition at line 384 of file TextRegionUtil.java.

◆ setCacheLimit() [1/2]

final void com.jogamp.graph.curve.opengl.TextRegionUtil.setCacheLimit ( final GL2ES2  gl,
final int  newLimit 
)

Sets the cache limit, see setCacheLimit(int) and validates the cache.

See also
setCacheLimit(int)
Parameters
glcurrent GL used to remove cached objects if required
newLimitnew cache size

Definition at line 374 of file TextRegionUtil.java.

◆ setCacheLimit() [2/2]

final void com.jogamp.graph.curve.opengl.TextRegionUtil.setCacheLimit ( final int  newLimit)

Sets the cache limit for reusing GlyphString's and their Region. Default is DEFAULT_CACHE_LIMIT, -1 unlimited, 0 turns cache off, >0 limited

The cache will be validate when the next string rendering happens.

Parameters
newLimitnew cache size
See also
DEFAULT_CACHE_LIMIT

Definition at line 364 of file TextRegionUtil.java.

Member Data Documentation

◆ DEFAULT_CACHE_LIMIT

final int com.jogamp.graph.curve.opengl.TextRegionUtil.DEFAULT_CACHE_LIMIT = 256
static

Default cache limit, see setCacheLimit(int).

Definition at line 458 of file TextRegionUtil.java.

◆ renderModes

final int com.jogamp.graph.curve.opengl.TextRegionUtil.renderModes

Definition at line 52 of file TextRegionUtil.java.

◆ tempT1

final AffineTransform com.jogamp.graph.curve.opengl.TextRegionUtil.tempT1 = new AffineTransform()

Definition at line 460 of file TextRegionUtil.java.

◆ tempT2

final AffineTransform com.jogamp.graph.curve.opengl.TextRegionUtil.tempT2 = new AffineTransform()

Definition at line 461 of file TextRegionUtil.java.


The documentation for this class was generated from the following file: