Modifier and Type | Class and Description |
---|---|
static interface |
TextRegionUtil.ShapeVisitor |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CACHE_LIMIT
Default cache limit, see
setCacheLimit(int) |
int |
renderModes |
jogamp.graph.geom.plane.AffineTransform |
tempT1 |
jogamp.graph.geom.plane.AffineTransform |
tempT2 |
Constructor and Description |
---|
TextRegionUtil(int renderModes) |
Modifier and Type | Method and Description |
---|---|
static void |
addStringToRegion(GLRegion region,
Vertex.Factory<? extends Vertex> vertexFactory,
Font font,
float pixelSize,
CharSequence str,
float[] rgbaColor,
jogamp.graph.geom.plane.AffineTransform temp1,
jogamp.graph.geom.plane.AffineTransform temp2)
Add the string in 3D space w.r.t.
|
void |
clear(GL2ES2 gl)
Clear all cached
GLRegions . |
static void |
drawString3D(GL2ES2 gl,
GLRegion region,
RegionRenderer renderer,
Font font,
float pixelSize,
CharSequence str,
float[] rgbaColor,
int[] sampleCount,
jogamp.graph.geom.plane.AffineTransform temp1,
jogamp.graph.geom.plane.AffineTransform temp2)
Render the string in 3D space w.r.t.
|
static void |
drawString3D(GL2ES2 gl,
int renderModes,
RegionRenderer renderer,
Font font,
float pixelSize,
CharSequence str,
float[] rgbaColor,
int[] sampleCount,
jogamp.graph.geom.plane.AffineTransform temp1,
jogamp.graph.geom.plane.AffineTransform temp2)
Render the string in 3D space w.r.t.
|
void |
drawString3D(GL2ES2 gl,
RegionRenderer renderer,
Font font,
float pixelSize,
CharSequence str,
float[] rgbaColor,
int[] sampleCount)
Render the string in 3D space w.r.t.
|
int |
getCacheLimit() |
int |
getCacheSize() |
static int |
getCharCount(String s,
char c) |
static void |
processString(TextRegionUtil.ShapeVisitor visitor,
jogamp.graph.geom.plane.AffineTransform transform,
Font font,
float pixelSize,
CharSequence str,
jogamp.graph.geom.plane.AffineTransform temp1,
jogamp.graph.geom.plane.AffineTransform temp2)
Visit each
Font.Glyph 's OutlineShape with the given TextRegionUtil.ShapeVisitor
additionally passing the progressed AffineTransform . |
void |
setCacheLimit(GL2ES2 gl,
int newLimit)
Sets the cache limit, see
setCacheLimit(int) and validates the cache. |
void |
setCacheLimit(int newLimit)
Sets the cache limit for reusing GlyphString's and their Region.
|
public final int renderModes
public static final int DEFAULT_CACHE_LIMIT
setCacheLimit(int)
public final jogamp.graph.geom.plane.AffineTransform tempT1
public final jogamp.graph.geom.plane.AffineTransform tempT2
public static int getCharCount(String s, char c)
public static void processString(TextRegionUtil.ShapeVisitor visitor, jogamp.graph.geom.plane.AffineTransform transform, Font font, float pixelSize, CharSequence str, jogamp.graph.geom.plane.AffineTransform temp1, jogamp.graph.geom.plane.AffineTransform temp2)
Font.Glyph
's OutlineShape
with the given TextRegionUtil.ShapeVisitor
additionally passing the progressed AffineTransform
.
The latter reflects the given font metric, pixelSize and hence character position.visitor
- transform
- optional given transformfont
- the target Font
pixelSize
- Use Font.getPixelSize(float, float)
for resolution correct pixel-size.str
- string texttemp1
- temporary AffineTransform storage, mandatory, will be passed to TextRegionUtil.ShapeVisitor.visit(OutlineShape, AffineTransform)
and can be modified.temp2
- temporary AffineTransform storage, mandatory, can be re-used in TextRegionUtil.ShapeVisitor.visit(OutlineShape, AffineTransform)
by user code.public static void addStringToRegion(GLRegion region, Vertex.Factory<? extends Vertex> vertexFactory, Font font, float pixelSize, CharSequence str, float[] rgbaColor, jogamp.graph.geom.plane.AffineTransform temp1, jogamp.graph.geom.plane.AffineTransform temp2)
GLRegion
.region
- the GLRegion
sinkvertexFactory
- vertex impl factory Vertex.Factory
font
- the target Font
pixelSize
- Use Font.getPixelSize(float, float)
for resolution correct pixel-size.str
- string textrgbaColor
- if Region.hasColorChannel()
RGBA color must be passed, otherwise value is ignored.temp1
- temporary AffineTransform storage, mandatorytemp2
- temporary AffineTransform storage, mandatorypublic void drawString3D(GL2ES2 gl, RegionRenderer renderer, Font font, float pixelSize, CharSequence str, float[] rgbaColor, int[] sampleCount)
GLRegion
for reuse.
Cached GLRegion
s will be destroyed w/ clear(GL2ES2)
or to free memory.
gl
- the current GL staterenderer
- TODOfont
- Font
to be usedpixelSize
- Use Font.getPixelSize(float, float)
for resolution correct pixel-size.str
- text to be renderedrgbaColor
- if Region.hasColorChannel()
RGBA color must be passed, otherwise value is ignored.sampleCount
- desired multisampling sample count for msaa-rendering.
The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.Exception
- if TextRenderer not initializedpublic static void drawString3D(GL2ES2 gl, int renderModes, RegionRenderer renderer, Font font, float pixelSize, CharSequence str, float[] rgbaColor, int[] sampleCount, jogamp.graph.geom.plane.AffineTransform temp1, jogamp.graph.geom.plane.AffineTransform temp2)
GLRegion
, which will be destroyed afterwards.
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, float, CharSequence, float[], int[], AffineTransform, AffineTransform)
instead.
gl
- the current GL staterenderModes
- TODOfont
- Font
to be usedpixelSize
- Use Font.getPixelSize(float, float)
for resolution correct pixel-size.str
- text to be renderedrgbaColor
- if Region.hasColorChannel()
RGBA color must be passed, otherwise value is ignored.sampleCount
- desired multisampling sample count for msaa-rendering.
The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.temp1
- temporary AffineTransform storage, mandatorytemp2
- temporary AffineTransform storage, mandatoryException
- if TextRenderer not initializedpublic static void drawString3D(GL2ES2 gl, GLRegion region, RegionRenderer renderer, Font font, float pixelSize, CharSequence str, float[] rgbaColor, int[] sampleCount, jogamp.graph.geom.plane.AffineTransform temp1, jogamp.graph.geom.plane.AffineTransform temp2)
GLRegion
, which will cleared
beforehand.gl
- the current GL statefont
- Font
to be usedpixelSize
- Use Font.getPixelSize(float, float)
for resolution correct pixel-size.str
- text to be renderedrgbaColor
- if Region.hasColorChannel()
RGBA color must be passed, otherwise value is ignored.sampleCount
- desired multisampling sample count for msaa-rendering.
The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.temp1
- temporary AffineTransform storage, mandatorytemp2
- temporary AffineTransform storage, mandatoryException
- if TextRenderer not initializedpublic void clear(GL2ES2 gl)
GLRegions
.public final void setCacheLimit(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.
newLimit
- new cache sizeDEFAULT_CACHE_LIMIT
public final void setCacheLimit(GL2ES2 gl, int newLimit)
setCacheLimit(int)
and validates the cache.gl
- current GL used to remove cached objects if requirednewLimit
- new cache sizesetCacheLimit(int)
public final int getCacheLimit()
public final int getCacheSize()
getCacheLimit()
Copyright 2010 JogAmp Community.