Package com.jogamp.graph.curve.opengl
Class RenderState
- java.lang.Object
-
- com.jogamp.graph.curve.opengl.RenderState
-
public class RenderState extends Object
The RenderState is owned byRegionRenderer
. It holds rendering state data likePMVMatrix4f
, viewport, but also the currentstatic color
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RenderState.ProgramLocal
-
Field Summary
Fields Modifier and Type Field Description static int
BITHINT_BLENDING_ENABLED
Bitfield hint,if set
stating enabledGL.GL_BLEND
, otherwise disabled.static int
BITHINT_GLOBAL_DEPTH_TEST_ENABLED
Bitfield hint,if set
stating globally enabledGL.GL_DEPTH_TEST
, otherwise disabled.static int
DEBUG_LINESTRIP
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RenderState
attachTo(GL2ES2 gl)
void
clearDebugBits(int mask)
void
clearHintBits(int mask)
boolean
debugBitsSet(int mask)
boolean
detachFrom(GL2ES2 gl)
int
getAAQuality()
Returns pass2 AA-quality rendering value for Graph Region AArender-modes
:Region.VBAA_RENDERING_BIT
.com.jogamp.math.geom.Frustum
getClipFrustum()
Returns the optional Mv-premultiplied clippingFrustum
or null if unused.com.jogamp.math.Vec4f
getColorStatic(com.jogamp.math.Vec4f rgbaColor)
int
getDebugBits()
int
getHintBits()
com.jogamp.math.util.PMVMatrix4f
getMatrix()
Borrow the currentPMVMatrix4f
.static RenderState
getRenderState(GL2ES2 gl)
int
getSampleCount()
Returns pass2 AA sample count for Graph Region AArender-modes
:#VBAA_RENDERING_BIT
orRegion.MSAA_RENDERING_BIT
.ShaderProgram
getShaderProgram()
Return the currentShaderProgram
float
getWeight()
boolean
hintBitsSet(int mask)
int
id()
boolean
isShaderProgramInUse()
Return whether the currentShaderProgram
isin use
.static boolean
isWeightValid(float v)
int
setAAQuality(int v)
Sets pass2 AA-quality rendering value clipped to the range [Region.MIN_AA_QUALITY
..Region.MAX_AA_QUALITY
] for Graph Region AArender-modes
:Region.VBAA_RENDERING_BIT
.void
setClipFrustum(com.jogamp.math.geom.Frustum clipFrustum)
Set the optional clippingFrustum
, which shall be pre-multiplied with the Mv-matrix or null to disable.void
setColorStatic(float r, float g, float b, float a)
void
setColorStatic(com.jogamp.math.Vec4f rgbaColor)
void
setDebugBits(int mask)
void
setHintBits(int mask)
int
setSampleCount(int v)
Sets pass2 AA sample count clipped to the range [Region.MIN_AA_SAMPLE_COUNT
..Region.MAX_AA_SAMPLE_COUNT
] for Graph Region AArender-modes
:#VBAA_RENDERING_BIT
orRegion.MSAA_RENDERING_BIT
.boolean
setShaderProgram(GL2ES2 gl, ShaderProgram spNext)
Sets the currentShaderProgram
and enables it.void
setWeight(float v)
String
toString()
boolean
updateAttributeLoc(GL2ES2 gl, boolean updateLocation, GLArrayDataWrapper data, boolean throwOnError)
boolean
updateUniformDataLoc(GL2ES2 gl, boolean updateLocation, boolean updateData, GLUniformData data, boolean throwOnError)
boolean
updateUniformLoc(GL2ES2 gl, boolean updateLocation, GLUniformData data, boolean throwOnError)
-
-
-
Field Detail
-
BITHINT_BLENDING_ENABLED
public static final int BITHINT_BLENDING_ENABLED
Bitfield hint,if set
stating enabledGL.GL_BLEND
, otherwise disabled.Shall be set via
setHintBits(int)
and cleared viaclearHintBits(int)
.If set,
GLRegion's draw-method
will set the properblend-function
and the clear-color to transparent-black in case ofmultipass
FBO rendering.Shall be set by custom code, e.g. via
RegionRenderer
's enable and disableRegionRenderer.GLCallback
as done inRegionRenderer.defaultBlendEnable
andRegionRenderer.defaultBlendDisable
.- See Also:
- Constant Field Values
-
BITHINT_GLOBAL_DEPTH_TEST_ENABLED
public static final int BITHINT_GLOBAL_DEPTH_TEST_ENABLED
Bitfield hint,if set
stating globally enabledGL.GL_DEPTH_TEST
, otherwise disabled.Shall be set via
setHintBits(int)
and cleared viaclearHintBits(int)
.GLRegion's draw-method
may toggle depth test, and reset it's state according to this hint.Shall be set by custom code, e.g. after
RenderState
orRegionRenderer
construction.- See Also:
- Constant Field Values
-
DEBUG_LINESTRIP
public static final int DEBUG_LINESTRIP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRenderState
public static final RenderState getRenderState(GL2ES2 gl)
-
id
public final int id()
-
getShaderProgram
public final ShaderProgram getShaderProgram()
Return the currentShaderProgram
-
isShaderProgramInUse
public final boolean isShaderProgramInUse()
Return whether the currentShaderProgram
isin use
.
-
setShaderProgram
public final boolean setShaderProgram(GL2ES2 gl, ShaderProgram spNext)
Sets the currentShaderProgram
and enables it. If the givenShaderProgram
is notthe current
, method returns true, otherwise false.- Parameters:
gl
-spNext
- the next currentShaderProgram
to be set and enabled- 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.
-
getMatrix
public final com.jogamp.math.util.PMVMatrix4f getMatrix()
Borrow the currentPMVMatrix4f
.
-
isWeightValid
public static boolean isWeightValid(float v)
-
getWeight
public final float getWeight()
-
setWeight
public final void setWeight(float v)
-
getColorStatic
public final com.jogamp.math.Vec4f getColorStatic(com.jogamp.math.Vec4f rgbaColor)
-
setColorStatic
public final void setColorStatic(com.jogamp.math.Vec4f rgbaColor)
-
setColorStatic
public final void setColorStatic(float r, float g, float b, float a)
-
setAAQuality
public final int setAAQuality(int v)
Sets pass2 AA-quality rendering value clipped to the range [Region.MIN_AA_QUALITY
..Region.MAX_AA_QUALITY
] for Graph Region AArender-modes
:Region.VBAA_RENDERING_BIT
.
-
getAAQuality
public final int getAAQuality()
Returns pass2 AA-quality rendering value for Graph Region AArender-modes
:Region.VBAA_RENDERING_BIT
.
-
setSampleCount
public final int setSampleCount(int v)
Sets pass2 AA sample count clipped to the range [Region.MIN_AA_SAMPLE_COUNT
..Region.MAX_AA_SAMPLE_COUNT
] for Graph Region AArender-modes
:#VBAA_RENDERING_BIT
orRegion.MSAA_RENDERING_BIT
.
-
getSampleCount
public final int getSampleCount()
Returns pass2 AA sample count for Graph Region AArender-modes
:#VBAA_RENDERING_BIT
orRegion.MSAA_RENDERING_BIT
.
-
setClipFrustum
public final void setClipFrustum(com.jogamp.math.geom.Frustum clipFrustum)
Set the optional clippingFrustum
, which shall be pre-multiplied with the Mv-matrix or null to disable.
-
getClipFrustum
public final com.jogamp.math.geom.Frustum getClipFrustum()
Returns the optional Mv-premultiplied clippingFrustum
or null if unused.
-
getHintBits
public final int getHintBits()
-
hintBitsSet
public final boolean hintBitsSet(int mask)
-
setHintBits
public final void setHintBits(int mask)
-
clearHintBits
public final void clearHintBits(int mask)
-
getDebugBits
public final int getDebugBits()
-
debugBitsSet
public final boolean debugBitsSet(int mask)
-
setDebugBits
public final void setDebugBits(int mask)
-
clearDebugBits
public final void clearDebugBits(int mask)
-
updateUniformLoc
public final boolean updateUniformLoc(GL2ES2 gl, boolean updateLocation, GLUniformData data, boolean throwOnError)
- Parameters:
gl
-updateLocation
-data
-throwOnError
- TODO- Returns:
- true if no error occured, i.e. all locations found, otherwise false.
-
updateUniformDataLoc
public final boolean updateUniformDataLoc(GL2ES2 gl, boolean updateLocation, boolean updateData, GLUniformData data, boolean throwOnError)
- Parameters:
gl
-updateLocation
-updateData
- TODOdata
-throwOnError
- TODO- Returns:
- true if no error occured, i.e. all locations found, otherwise false.
-
updateAttributeLoc
public final boolean updateAttributeLoc(GL2ES2 gl, boolean updateLocation, GLArrayDataWrapper data, boolean throwOnError)
- Parameters:
gl
-data
-throwOnError
- TODO- Returns:
- true if no error occured, i.e. all locations found, otherwise false.
-
attachTo
public final RenderState attachTo(GL2ES2 gl)
-
detachFrom
public final boolean detachFrom(GL2ES2 gl)
-
-