Class GLRegion
- java.lang.Object
-
- com.jogamp.graph.curve.Region
-
- com.jogamp.graph.curve.opengl.GLRegion
-
public abstract class GLRegion extends Region
A GLRegion is the OGL binding of one or more OutlineShapes Defined by its vertices and generated triangles. The Region defines the final shape of the OutlineShape(s), which shall produced a shaded region on the screen. Implementations of the GLRegion shall take care of the OGL binding of the depending on its context, profile.- See Also:
Region
,OutlineShape
-
-
Field Summary
Fields Modifier and Type Field Description static int
defaultIndicesCount
Default initial indices count 64, assuming small sized shapes.static int
defaultVerticesCount
Default initial vertices count 64, assuming small sized shapes.-
Fields inherited from class com.jogamp.graph.curve.Region
COLORCHANNEL_RENDERING_BIT, COLORTEXTURE_RENDERING_BIT, DEBUG, DEBUG_INSTANCE, DEFAULT_TWO_PASS_TEXTURE_UNIT, MAX_QUALITY, MSAA_RENDERING_BIT, NORM_RENDERING_BIT, VARWEIGHT_RENDERING_BIT, VBAA_RENDERING_BIT
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components)
GLRegion
clear(GL2ES2 gl)
Clears all buffers, i.e.static GLRegion
create(GLProfile glp, int renderModes, TextureSequence colorTexSeq)
Create a GLRegion using the passed render mode and default initial buffer sizesdefaultVerticesCount
anddefaultIndicesCount
.static GLRegion
create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, int initialVerticesCount, int initialIndicesCount)
Create a GLRegion using the passed render modestatic GLRegion
create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, int pass2TexUnit, int initialVerticesCount, int initialIndicesCount)
Create a GLRegion using the passed render modestatic GLRegion
create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, OutlineShape shape)
Create a GLRegion using the passed render mode and pre-calculating its buffer sizes usingRegion.countOutlineShape(OutlineShape, int[])
.static GLRegion
create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, Font font, CharSequence str)
Create a GLRegion using the passed render mode and pre-calculating its buffer sizes using given font'sFont.processString(com.jogamp.graph.font.Font.GlyphVisitor2, CharSequence)
toRegion.countOutlineShape(OutlineShape, int[])
.GLArrayDataServer
createInterleaved(boolean useMappedBuffers, int comps, int dataType, boolean normalized, int initialSize, int vboUsage)
void
destroy(GL2ES2 gl)
Delete and clear the associated OGL objects.void
draw(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)
Renders the associated OGL objects specifying current width/hight of window for multi pass rendering of the region.boolean
growBuffer(int verticesCount, int indicesCount)
Increase the renderer buffers if necessary to add given counts of vertices- and index elements.void
printBufferStats(PrintStream out)
Print implementation buffer stats like detailed and total size and capacity in bytes etcboolean
setBufferCapacity(int verticesCount, int indicesCount)
Set the renderer buffers pre-emptively for given vertices- and index counts.abstract void
setTextureUnit(int pass2TexUnit)
Set the 2nd pass texture unit.-
Methods inherited from class com.jogamp.graph.curve.Region
addOutlineShape, addOutlineShapes, countOutlineShape, countOutlineShapes, getBounds, getFrustum, getQuality, getRenderModes, getRenderModeString, getRenderModeString, hasColorChannel, hasColorChannel, hasColorTexture, hasColorTexture, hasVariableWeight, hasVariableWeight, isMSAA, isMSAA, isShapeDirty, isStateDirty, isTwoPass, isVBAA, isVBAA, markShapeDirty, markStateDirty, perfCounter, setFrustum, setQuality, toString, usesI32Idx
-
-
-
-
Field Detail
-
defaultVerticesCount
public static final int defaultVerticesCount
Default initial vertices count 64, assuming small sized shapes.- See Also:
- Constant Field Values
-
defaultIndicesCount
public static final int defaultIndicesCount
Default initial indices count 64, assuming small sized shapes.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static GLRegion create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, int pass2TexUnit, int initialVerticesCount, int initialIndicesCount)
Create a GLRegion using the passed render mode- Parameters:
glp
- intended GLProfile to use. Instance may use higher OpenGL features if indicated by GLProfile.renderModes
- bit-field of modes, e.g.Region.VARWEIGHT_RENDERING_BIT
,Region.VBAA_RENDERING_BIT
colorTexSeq
- optionalTextureSequence
forRegion.COLORTEXTURE_RENDERING_BIT
rendering mode.pass2TexUnit
- texture unit for 2nd pass rendering (Region.VBAA_RENDERING_BIT
), default isRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT
.initialVerticesCount
- initial number of vertices in the render-bufferinitialIndicesCount
- initial number of indices in the render-buffer
-
create
public static GLRegion create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, int initialVerticesCount, int initialIndicesCount)
Create a GLRegion using the passed render modeIn case
Region.VBAA_RENDERING_BIT
is being requested the default texture unitRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT
is being used.- Parameters:
glp
- intended GLProfile to use. Instance may use higher OpenGL features if indicated by GLProfile.renderModes
- bit-field of modes, e.g.Region.VARWEIGHT_RENDERING_BIT
,Region.VBAA_RENDERING_BIT
colorTexSeq
- optionalTextureSequence
forRegion.COLORTEXTURE_RENDERING_BIT
rendering mode.initialVerticesCount
- initial number of vertices in the render-bufferinitialIndicesCount
- initial number of indices in the render-buffer
-
create
public static GLRegion create(GLProfile glp, int renderModes, TextureSequence colorTexSeq)
Create a GLRegion using the passed render mode and default initial buffer sizesdefaultVerticesCount
anddefaultIndicesCount
.In case
Region.VBAA_RENDERING_BIT
is being requested the default texture unitRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT
is being used.- Parameters:
glp
- intended GLProfile to use. Instance may use higher OpenGL features if indicated by GLProfile.renderModes
- bit-field of modes, e.g.Region.VARWEIGHT_RENDERING_BIT
,Region.VBAA_RENDERING_BIT
colorTexSeq
- optionalTextureSequence
forRegion.COLORTEXTURE_RENDERING_BIT
rendering mode.
-
create
public static GLRegion create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, OutlineShape shape)
Create a GLRegion using the passed render mode and pre-calculating its buffer sizes usingRegion.countOutlineShape(OutlineShape, int[])
.In case
Region.VBAA_RENDERING_BIT
is being requested the default texture unitRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT
is being used.- Parameters:
glp
- intended GLProfile to use. Instance may use higher OpenGL features if indicated by GLProfile.renderModes
- bit-field of modes, e.g.Region.VARWEIGHT_RENDERING_BIT
,Region.VBAA_RENDERING_BIT
colorTexSeq
- optionalTextureSequence
forRegion.COLORTEXTURE_RENDERING_BIT
rendering mode.shape
- theOutlineShape
used to determineGLRegion
's buffer sizes viaRegion.countOutlineShape(OutlineShape, int[])
-
create
public static GLRegion create(GLProfile glp, int renderModes, TextureSequence colorTexSeq, Font font, CharSequence str)
Create a GLRegion using the passed render mode and pre-calculating its buffer sizes using given font'sFont.processString(com.jogamp.graph.font.Font.GlyphVisitor2, CharSequence)
toRegion.countOutlineShape(OutlineShape, int[])
.In case
Region.VBAA_RENDERING_BIT
is being requested the default texture unitRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT
is being used.- Parameters:
glp
- intended GLProfile to use. Instance may use higher OpenGL features if indicated by GLProfile.renderModes
- bit-field of modes, e.g.Region.VARWEIGHT_RENDERING_BIT
,Region.VBAA_RENDERING_BIT
colorTexSeq
- optionalTextureSequence
forRegion.COLORTEXTURE_RENDERING_BIT
rendering mode.font
- Font used toFont#processString(com.jogamp.graph.curve.OutlineShape.Visitor2, CharSequence)
toto count initial number of vertices and indices
str
- the string used to toto count initial number of vertices and indices
-
createInterleaved
public GLArrayDataServer createInterleaved(boolean useMappedBuffers, int comps, int dataType, boolean normalized, int initialSize, int vboUsage)
-
addInterleavedVertexAndNormalArrays
public void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components)
-
growBuffer
public final boolean growBuffer(int verticesCount, int indicesCount)
Description copied from class:Region
Increase the renderer buffers if necessary to add given counts of vertices- and index elements.Buffers will not change if remaining free slots, capacity less position, satisfy count elements.
- Specified by:
growBuffer
in classRegion
- Parameters:
verticesCount
- number of vertex elements to add if necessaryindicesCount
- number of index elements to add if necessary- Returns:
- true if buffer size has changed, i.e. grown. Otherwise false.
- See Also:
Region.setBufferCapacity(int, int)
,Region.countOutlineShape(OutlineShape, int[])
,Region.countOutlineShapes(List, int[])
-
setBufferCapacity
public final boolean setBufferCapacity(int verticesCount, int indicesCount)
Description copied from class:Region
Set the renderer buffers pre-emptively for given vertices- and index counts.Buffers will not change if given count elements is lower or equal current capacity.
- Specified by:
setBufferCapacity
in classRegion
- Parameters:
verticesCount
- number of vertices to holdindicesCount
- number of indices to hold- Returns:
- true if buffer size has changed, i.e. grown. Otherwise false.
- See Also:
Region.growBuffer(int, int)
,Region.countOutlineShape(OutlineShape, int[])
,Region.countOutlineShapes(List, int[])
-
printBufferStats
public final void printBufferStats(PrintStream out)
Description copied from class:Region
Print implementation buffer stats like detailed and total size and capacity in bytes etc- Specified by:
printBufferStats
in classRegion
-
setTextureUnit
public abstract void setTextureUnit(int pass2TexUnit)
Set the 2nd pass texture unit.
-
clear
public final GLRegion clear(GL2ES2 gl)
Clears all buffers, i.e. triangles, vertices etc and and resets states accordingly, seeGLArrayDataEditable.clear(GL)
.This method does not actually erase the data in the buffer and will most often be used when erasing the underlying memory is suitable.
- Parameters:
gl
- the currentGL2ES2
object- Returns:
- this
GLRegion
for chaining. - See Also:
GLArrayDataEditable.clear(GL)
-
destroy
public final void destroy(GL2ES2 gl)
Delete and clear the associated OGL objects.The
ShaderProgram
s references are nullified but notdestroyed
as they are owned byRegionRenderer
.
-
draw
public final void draw(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)
Renders the associated OGL objects specifying current width/hight of window for multi pass rendering of the region.User shall consider
enabling
the renderer beforehand anddisabling
it afterwards when used in conjunction with other renderer.Users shall also consider setting the
clear-color
appropriately:- If
blending
is enabled, RGB shall be set to text color, otherwise blending will reduce the alpha seam's contrast and the font will appear thinner. - If
blending
is disabled, RGB shall be set to the actual desired background.
blending
is enabled, theRegionRenderer
might need to becreated
with the appropriatecallbacks
.- Parameters:
matrix
- currentPMVMatrix
.renderer
- theRegionRenderer
to be usedsampleCount
- desired multisampling sample count for vbaa- or msaa-rendering. Use -1 for glSelect mode, pass1 w/o any color texture nor channel, use static select color only. The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.- See Also:
RegionRenderer.enable(GL2ES2, boolean)
- If
-
-