Interface GlyphRenderer
-
- All Known Implementing Classes:
GlyphRendererGL2,GlyphRendererGL3
public interface GlyphRendererUtility for drawing glyphs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceGlyphRenderer.EventListenerObserver of aGlyphRenderer.static classGlyphRenderer.EventTypeType of event fired from the renderer.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(GlyphRenderer.EventListener listener)Registers anGlyphRenderer.EventListenerwith thisGlyphRenderer.voidbeginRendering(com.jogamp.opengl.GL gl, boolean ortho, int width, int height, boolean disableDepthTest)Starts a render cycle with thisGlyphRenderer.voiddispose(com.jogamp.opengl.GL gl)Frees resources used by thisGlyphRenderer.floatdrawGlyph(com.jogamp.opengl.GL gl, Glyph glyph, float x, float y, float z, float scale, com.jogamp.opengl.util.texture.TextureCoords coords)Draws a glyph with thisGlyphRenderer.voidendRendering(com.jogamp.opengl.GL gl)Finishes a render cycle with thisGlyphRenderer.voidflush(com.jogamp.opengl.GL gl)Forces all stored text to be rendered.booleangetUseVertexArrays()Checks if thisGlyphRendereris using vertex arrays.voidsetColor(float r, float g, float b, float a)Changes the color used to draw the text.voidsetTransform(float[] value, boolean transpose)Changes the transformation matrix for drawing in 3D.voidsetUseVertexArrays(boolean useVertexArrays)Changes whether vertex arrays are in use.
-
-
-
Method Detail
-
addListener
void addListener(GlyphRenderer.EventListener listener)
Registers anGlyphRenderer.EventListenerwith thisGlyphRenderer.- Parameters:
listener- Listener to register- Throws:
NullPointerException- if listener is null
-
beginRendering
void beginRendering(com.jogamp.opengl.GL gl, boolean ortho, int width, int height, boolean disableDepthTest)Starts a render cycle with thisGlyphRenderer.- Parameters:
gl- Current OpenGL contextortho- True if using orthographic projectionwidth- Width of current OpenGL viewportheight- Height of current OpenGL viewportdisableDepthTest- True if should ignore depth values- Throws:
NullPointerException- if context is nullIllegalArgumentException- if width or height is negativecom.jogamp.opengl.GLException- if context is unexpected version
-
dispose
void dispose(com.jogamp.opengl.GL gl)
Frees resources used by thisGlyphRenderer.- Parameters:
gl- Current OpenGL context- Throws:
NullPointerException- if context is nullcom.jogamp.opengl.GLException- if context is unexpected version
-
drawGlyph
float drawGlyph(com.jogamp.opengl.GL gl, Glyph glyph, float x, float y, float z, float scale, com.jogamp.opengl.util.texture.TextureCoords coords)Draws a glyph with thisGlyphRenderer.- Parameters:
gl- Current OpenGL contextglyph- Visual representation of a characterx- Position to draw on X axis, which may be negativey- Position to draw on Y axis, which may be negativez- Position to draw on Z axis, which may be negativescale- Relative size of glyph, which may be negativecoords- Texture coordinates of glyph- Returns:
- Distance to next character, which may be negative
- Throws:
NullPointerException- if context, glyph, or texture coordinate is nullcom.jogamp.opengl.GLException- if context is unexpected version
-
endRendering
void endRendering(com.jogamp.opengl.GL gl)
Finishes a render cycle with thisGlyphRenderer.- Parameters:
gl- Current OpenGL context- Throws:
NullPointerException- if context is nullcom.jogamp.opengl.GLException- if context is unexpected version
-
flush
void flush(com.jogamp.opengl.GL gl)
Forces all stored text to be rendered.- Parameters:
gl- Current OpenGL context- Throws:
NullPointerException- if context is nullcom.jogamp.opengl.GLException- if context is unexpected versionIllegalStateException- if not in a render cycle
-
getUseVertexArrays
boolean getUseVertexArrays()
Checks if thisGlyphRendereris using vertex arrays.- Returns:
- True if this renderer is using vertex arrays
-
setColor
void setColor(float r, float g, float b, float a)Changes the color used to draw the text.- Parameters:
r- Red component of colorg- Green component of colorb- Blue component of colora- Alpha component of color
-
setTransform
void setTransform(float[] value, boolean transpose)Changes the transformation matrix for drawing in 3D.- Parameters:
gl- Current OpenGL contextvalue- Matrix as float arraytranspose- True if array is in in row-major order- Throws:
IndexOutOfBoundsException- if value's length is less than sixteenIllegalStateException- if in orthographic mode
-
setUseVertexArrays
void setUseVertexArrays(boolean useVertexArrays)
Changes whether vertex arrays are in use.- Parameters:
useVertexArrays- true to use vertex arrays
-
-