Class GlyphRendererGL2
- java.lang.Object
-
- com.metsci.glimpse.jogamp.opengl.util.awt.text.GlyphRendererGL2
-
- All Implemented Interfaces:
GlyphRenderer,QuadPipeline.EventListener
public final class GlyphRendererGL2 extends Object
GlyphRendererfor use with OpenGL 2.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.metsci.glimpse.jogamp.opengl.util.awt.text.GlyphRenderer
GlyphRenderer.EventListener, GlyphRenderer.EventType
-
-
Constructor Summary
Constructors Constructor Description GlyphRendererGL2()Constructs aGlyphRendererGL2.
-
Method Summary
All Methods Instance Methods Concrete 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.voidonQuadPipelineEvent(QuadPipeline.EventType type)Responds to an event from aQuadPipeline.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.
-
-
-
Constructor Detail
-
GlyphRendererGL2
public GlyphRendererGL2()
Constructs aGlyphRendererGL2.
-
-
Method Detail
-
getUseVertexArrays
public boolean getUseVertexArrays()
Description copied from interface:GlyphRendererChecks if thisGlyphRendereris using vertex arrays.- Returns:
- True if this renderer is using vertex arrays
-
setUseVertexArrays
public void setUseVertexArrays(boolean useVertexArrays)
Description copied from interface:GlyphRendererChanges whether vertex arrays are in use.- Parameters:
useVertexArrays- true to use vertex arrays
-
addListener
public final void addListener(GlyphRenderer.EventListener listener)
Description copied from interface:GlyphRendererRegisters anGlyphRenderer.EventListenerwith thisGlyphRenderer.- Specified by:
addListenerin interfaceGlyphRenderer- Parameters:
listener- Listener to register
-
beginRendering
public final void beginRendering(com.jogamp.opengl.GL gl, boolean ortho, int width, int height, boolean disableDepthTest)Description copied from interface:GlyphRendererStarts a render cycle with thisGlyphRenderer.- Specified by:
beginRenderingin interfaceGlyphRenderer- 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
-
dispose
public final void dispose(com.jogamp.opengl.GL gl)
Description copied from interface:GlyphRendererFrees resources used by thisGlyphRenderer.- Specified by:
disposein interfaceGlyphRenderer- Parameters:
gl- Current OpenGL context
-
drawGlyph
public final float drawGlyph(com.jogamp.opengl.GL gl, Glyph glyph, float x, float y, float z, float scale, com.jogamp.opengl.util.texture.TextureCoords coords)Description copied from interface:GlyphRendererDraws a glyph with thisGlyphRenderer.- Specified by:
drawGlyphin interfaceGlyphRenderer- 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
-
endRendering
public final void endRendering(com.jogamp.opengl.GL gl)
Description copied from interface:GlyphRendererFinishes a render cycle with thisGlyphRenderer.- Specified by:
endRenderingin interfaceGlyphRenderer- Parameters:
gl- Current OpenGL context
-
flush
public final void flush(com.jogamp.opengl.GL gl)
Description copied from interface:GlyphRendererForces all stored text to be rendered.- Specified by:
flushin interfaceGlyphRenderer- Parameters:
gl- Current OpenGL context
-
onQuadPipelineEvent
public final void onQuadPipelineEvent(QuadPipeline.EventType type)
Description copied from interface:QuadPipeline.EventListenerResponds to an event from aQuadPipeline.- Specified by:
onQuadPipelineEventin interfaceQuadPipeline.EventListener- Parameters:
type- Type of event
-
setColor
public final void setColor(float r, float g, float b, float a)Description copied from interface:GlyphRendererChanges the color used to draw the text.- Specified by:
setColorin interfaceGlyphRenderer- Parameters:
r- Red component of colorg- Green component of colorb- Blue component of colora- Alpha component of color
-
setTransform
public final void setTransform(float[] value, boolean transpose)Description copied from interface:GlyphRendererChanges the transformation matrix for drawing in 3D.- Specified by:
setTransformin interfaceGlyphRenderer- Parameters:
value- Matrix as float arraytranspose- True if array is in in row-major order
-
-