Class RegionRenderer
- java.lang.Object
-
- com.jogamp.graph.curve.opengl.RegionRenderer
-
public class RegionRenderer extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRegionRenderer.GLCallbackMay be passed toRegionRenderer ctor, e.g.
-
Field Summary
Fields Modifier and Type Field Description static RegionRenderer.GLCallbackdefaultBlendDisableDefaultGL.GL_BLENDdisableRegionRenderer.GLCallback, simply turning-off theGL.GL_BLENDstate and turning-on depth writing viaGL.glDepthMask(boolean)ifRenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLEDis set.static RegionRenderer.GLCallbackdefaultBlendEnableDefaultGL.GL_BLENDenableRegionRenderer.GLCallback, turning-off depth writing viaGL.glDepthMask(boolean)ifRenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLEDis set and turning-on theGL.GL_BLENDstate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RegionRenderercreate(RenderState rs, RegionRenderer.GLCallback enableCallback, RegionRenderer.GLCallback disableCallback)Create a Hardware accelerated Region Renderer.voiddestroy(GL2ES2 gl)voidenable(GL2ES2 gl, boolean enable)Enabling or disabling theRenderState'sshader program.intgetHeight()Return height of current viewportPMVMatrixgetMatrix()RenderStategetRenderState()intgetWidth()Return width of current viewportvoidinit(GL2ES2 gl, int renderModes)Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext if not initialized yet.booleanisInitialized()booleanisVBOSupported()voidreshapeNotify(int width, int height)No PMVMatrix operation is performed here.voidreshapeOrtho(int width, int height, float near, float far)voidreshapePerspective(float angle, int width, int height, float near, float far)booleanuseShaderProgram(GL2ES2 gl, int renderModes, boolean pass1, int quality, int sampleCount, TextureSequence colorTexSeq)
-
-
-
Field Detail
-
defaultBlendEnable
public static final RegionRenderer.GLCallback defaultBlendEnable
DefaultGL.GL_BLENDenableRegionRenderer.GLCallback, turning-off depth writing viaGL.glDepthMask(boolean)ifRenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLEDis set and turning-on theGL.GL_BLENDstate.Implementation also sets
RenderState'sblending bit-hint, which will causeGLRegion's draw-methodto set the properblend-functionand the clear-color to transparent-black in case ofmultipassFBO rendering.
-
defaultBlendDisable
public static final RegionRenderer.GLCallback defaultBlendDisable
DefaultGL.GL_BLENDdisableRegionRenderer.GLCallback, simply turning-off theGL.GL_BLENDstate and turning-on depth writing viaGL.glDepthMask(boolean)ifRenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLEDis set.Implementation also clears
RenderState'sblending bit-hint.
-
-
Method Detail
-
create
public static RegionRenderer create(RenderState rs, RegionRenderer.GLCallback enableCallback, RegionRenderer.GLCallback disableCallback)
Create a Hardware accelerated Region Renderer.The optional
RegionRenderer.GLCallbacksenableCallbackanddisableCallbackmaybe used to issue certain tasks atenable(GL2ES2, boolean).
For example, instancesdefaultBlendEnableanddefaultBlendDisablecan be utilized to enable and disableGL.GL_BLEND.- Parameters:
rs- the usedRenderStateenableCallback- optionalRegionRenderer.GLCallback, if notnullwill be issued atinit(gl)andenable(gl, true).disableCallback- optionalRegionRenderer.GLCallback, if notnullwill be issued atenable(gl, false).- Returns:
- an instance of Region Renderer
- See Also:
enable(GL2ES2, boolean)
-
isInitialized
public final boolean isInitialized()
-
getWidth
public final int getWidth()
Return width of current viewport
-
getHeight
public final int getHeight()
Return height of current viewport
-
getMatrix
public final PMVMatrix getMatrix()
-
isVBOSupported
public final boolean isVBOSupported()
-
init
public final void init(GL2ES2 gl, int renderModes) throws GLException
Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext if not initialized yet.Leaves the renderer enabled, ie ShaderState.
Shall be called by a
draw()method, e.g.RegionRenderer#draw(GL2ES2, Region, int)- Parameters:
gl- referencing the current GLContext to which the ShaderState is bound torenderModes-- Throws:
GLException- if initialization failed
-
destroy
public final void destroy(GL2ES2 gl)
-
getRenderState
public final RenderState getRenderState()
-
enable
public final void enable(GL2ES2 gl, boolean enable)
Enabling or disabling theRenderState'sshader program.In case enable and disable
RegionRenderer.GLCallbacks are setup viacreate(RenderState, GLCallback, GLCallback), they will be called before toggling the shader program.
-
reshapeNotify
public final void reshapeNotify(int width, int height)No PMVMatrix operation is performed here. PMVMatrix is marked dirty.
-
reshapePerspective
public final void reshapePerspective(float angle, int width, int height, float near, float far)
-
reshapeOrtho
public final void reshapeOrtho(int width, int height, float near, float far)
-
useShaderProgram
public final boolean useShaderProgram(GL2ES2 gl, int renderModes, boolean pass1, int quality, int sampleCount, TextureSequence colorTexSeq)
- Parameters:
gl-renderModes-pass1-quality-sampleCount-colorTexSeq-- Returns:
- true if a new shader program is being used and hence external uniform-data and -location, as well as the attribute-location must be updated, otherwise false.
-
-