public class SoGLRenderAction extends SoAction
This class has many options for rendering, but the most commonly used methods are exposed by the viewer classes (SoWin, SoXt, SoQt) for convenience. The viewer classes automatically create a render action for you.
Traversal order
In most cases objects are rendered during the SoGLRenderAction
traversal of the scene graph, in the order they are encountered during the traversal. However rendering of some objects may be delayed until after the scene graph traversal, particularly transparent objects.
A transparent object is an object:
Open Inventor automatically detects these cases.
The rendering order for transparent objects depends on the transparency "type" (transparency rendering method) assigned to each object. A transparency type may be set for the entire scene graph using the SoGLRenderAction
or SoWinRenderArea method. The transparency type may also be modified during traversal using the SoTransparencyType
node.
There are several special cases including:
SoRenderList
nodes, e.g. SoOctreeOrdering
.The general rendering order is:
SoSeparator
node with fastEditing field set to KEEP_ZBUFFER.
SoAnnotation
node.
SoSeparator
node with fastEditing field set to CLEAR_ZBUFFER.
SoFrontBufferGroup
(after the buffer swap).
Elements
Sets: SoDecimationTypeElement
, SoDecimationPercentageElement
, SoUpdateAreaElement, SoRenderPassElement, SoViewportRegionElement
, SoLogicalViewportElement
See also:
SoSeparator
, SoWinRenderArea
Modifier and Type | Class and Description |
---|---|
static class |
SoGLRenderAction.AbortCodes
Possible return codes from a render abort callback.
|
static class |
SoGLRenderAction.AutoCacheModes
Two bits are stored.
|
static class |
SoGLRenderAction.FastEditSavePolicies
Fast edit traversal types.
|
static class |
SoGLRenderAction.InvalidateCacheModes
Invalidate cache mode.
|
static class |
SoGLRenderAction.TransparencyTypes
Transparency rendering algorithm.
|
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndices
Inventor.ConstructorCommand
ALL, BELOW_PATH, CLUSTER_ONLY, IN_PATH, LOCAL_ONLY, NO_PATH, NODE, OFF_PATH, PATH, PATH_LIST
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoGLRenderAction(SbViewportRegion viewportRegion)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
abortNow() |
void |
enableDepthPeeling3D(boolean flag)
Use 3D texturing instead of 2D for the fixed functionality emulation in depth peeling.
|
static void |
enableElement(java.lang.Class<? extends Inventor> t,
int stkIndex) |
static int |
generateCacheContext()
Generates and returns a new cache context id.
|
int |
getCacheContext()
Returns the OpenGL cache context id for this action.
|
int |
getCurPass() |
float |
getDecimationPercentage()
Gets decimation percentage, the value should be a number between 0.0 and 1.0.
|
SoDecimationTypeElement.Types |
getDecimationType()
Gets decimation type.
|
boolean |
getDelayedObjDepthWrite()
Returns whether delayed transparent objects update the depth buffer.
|
int |
getDepthPeelingPass()
Get the current pass of depth peeling, -1 if not doing depth peeling.
|
SoGLRenderAction.FastEditSavePolicies |
getFastEditSavePolicy()
Returns fast editing save policy used when rendering.
|
int |
getFrameCounter()
Returns the current frame counter.
|
SoGLRenderAction.InvalidateCacheModes |
getInvalidateCacheMode()
Returns the current cache invalidation mode.
|
SbViewportRegion |
getLogicalViewportRegion()
Returns current logical viewport region.
|
int |
getNumPasses()
Gets number of rendering passes for multipass rendering.
|
boolean |
getRenderingIsRemote()
Returns true if remote rendering is being done.
|
int |
getSortedLayersNumPasses()
Returns the number of rendering passes used when transparency type is
SORTED_PIXELS_BLEND . |
int |
getSortedTrianglesNumCaches()
Returns the maximum number of caches allowed for the sorted triangles transparency types.
|
int |
getSortedTrianglesSortFrequency()
Returns the sort frequency used for the SORTED_TRIANGLES_XXX and SORTED_OBJECT_TRIANGLES_XXX transparency types.
|
long |
getSynchronizer()
Deprecated.
As of Open Inventor 9.1.
|
SoGLRenderAction.TransparencyTypes |
getTransparencyType()
Returns transparency quality level to use when rendering.
|
SbVec2f[] |
getUpdateArea()
Returns the current update area.
|
SbViewportRegion |
getViewportRegion()
Returns viewport region to use for rendering.
|
boolean |
handleTransparency()
Calls handleTransparency(false, false).
|
boolean |
handleTransparency(boolean isTransparent)
Calls handleTransparency(isTransparent, false).
|
boolean |
handleTransparency(boolean isTransparent,
boolean isLinesOrPoints) |
void |
howToRenderScene(SoSensor sensor,
boolean newRender)
Deprecated.
As of Open Inventor 9.1.
|
boolean |
isAlphaTest()
Returns whether the OpenGL alpha test is enabled for rendering.
|
boolean |
isDoingDepthPeeling()
Return true if depth peeling is active.
|
boolean |
isPassUpdate()
Returns a flag indicating whether intermediate results are displayed after each antialiasing pass for progressive improvement.
|
boolean |
isSmoothing()
Returns smoothing flag.
|
static boolean |
isSortedLayersSupported()
Calls isSortedLayersSupported((com.openinventor.inventor.misc.SoState)null).
|
static boolean |
isSortedLayersSupported(SoState state)
Indicates if
SORTED_PIXELS_BLEND transparency is supported by your graphics board on the current context. |
static boolean |
isUsedCacheContext(int context)
Returns true if the specified cache context id is currently used by any
SoGLRenderAction . |
void |
postDelayedTraversal()
Method called by SoMultiPassManager after delayed pass traversals.
|
boolean |
preDelayedTraversal()
Method called by SoMultiPassManager before delayed pass traversals.
|
void |
resetFrameCounter()
Calls resetFrameCounter((int)0).
|
void |
resetFrameCounter(int count)
Reset the frame counter.
|
void |
setAlphaTest(boolean flag)
Enable or disable the OpenGL alpha test for rendering.
|
void |
setCacheContext(int context)
Sets the OpenGL cache context.
|
void |
setDecimationValue(SoDecimationTypeElement.Types type)
Calls setDecimationValue(type, (float)1.0).
|
void |
setDecimationValue(SoDecimationTypeElement.Types type,
float percentage)
Sets decimation percentage, the value should be a number between 0.0 and 1.0 Useful for reducing the number of triangles rendered in the scene.
|
void |
setDelayedObjDepthWrite(boolean flag)
Control whether delayed transparent objects update the depth buffer.
|
void |
setFastEditSavePolicy(SoGLRenderAction.FastEditSavePolicies policy)
Calls setFastEditSavePolicy(policy, false).
|
void |
setFastEditSavePolicy(SoGLRenderAction.FastEditSavePolicies policy,
boolean fastEditDelayedObjects)
Sets fast editing save policy to use when rendering.
|
void |
setInvalidateCacheMode(SoGLRenderAction.InvalidateCacheModes icm)
Enables or disables the invalidation of render caches.
|
void |
setLogicalViewportRegion(SbViewportRegion newLogicalRegion)
Sets current logical viewport region to use for rendering.
|
void |
setNumPasses(int num)
Sets number of rendering passes for multipass antialiasing.
|
void |
setPassCallback(SoGLRenderPassCB func) |
void |
setPassCallback(SoGLRenderPassCB func,
java.lang.Object userData) |
void |
setPassUpdate(boolean flag)
Sets a flag indicating whether intermediate results are displayed after each antialiasing pass for progressive improvement (default is false).
|
void |
setRenderingIsRemote(boolean flag)
Sets whether or not "remote" rendering is done.
|
void |
setSmoothing(boolean smooth)
Sets smoothing flag.
|
void |
setSortedLayersNumPasses(int num)
Sets the number of rendering passes used when transparency type is
SORTED_PIXELS_BLEND or DELAYED_SORTED_PIXELS_BLEND . |
void |
setSortedTrianglesNumCaches(int numCaches)
Sets the number of caches to use when the transparency type is SORTED_TRIANGLES_XXX or SORTED_OBJECT_TRIANGLES_XXX.
|
void |
setSortedTrianglesSortFrequency(int angle)
This method specifies the angle between each sorting axis when using the transparency type SORTED_TRIANGLES_XXX or SORTED_OBJECT_TRIANGLES_XXX.
|
void |
setTransparencyType(SoGLRenderAction.TransparencyTypes type)
Sets global transparency algorithm to use when rendering.
|
void |
setUpdateArea(SbVec2f origin,
SbVec2f size)
Sets the current update area, which is the rectangular area of the viewport region that will actually be rendered into.
|
void |
setUpState()
initialize the action state.
|
void |
setViewportRegion(SbViewportRegion newRegion)
Changes viewport region to use for rendering.
|
void |
shouldAutoCache(SoGLRenderAction.AutoCacheModes mode)
Called by nodes to say that they should/shouldn't be auto-cached (pass true if should, false if shouldn't, don't call this method at all if the node doesn't care):
|
void |
updateTranspList(SoSensor sensor)
Deprecated.
As of Open Inventor 9.1.
|
apply, apply, clearApplyResult, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, resetContinueActionInBranchFlag, setPipeId, setSceneManager, stopActionInBranch, traverse, useAlternateRep
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int SCREEN_DOOR
SoGLRenderAction.TransparencyTypes.SCREEN_DOOR
instead.@Deprecated public static final int ADD
SoGLRenderAction.TransparencyTypes.ADD
instead.@Deprecated public static final int DELAYED_ADD
SoGLRenderAction.TransparencyTypes.DELAYED_ADD
instead.@Deprecated public static final int BLEND
SoGLRenderAction.TransparencyTypes.BLEND
instead.@Deprecated public static final int DELAYED_BLEND
SoGLRenderAction.TransparencyTypes.DELAYED_BLEND
instead.@Deprecated public static final int SORTED_OBJECT_ADD
SoGLRenderAction.TransparencyTypes.SORTED_OBJECT_ADD
instead.@Deprecated public static final int SORTED_OBJECT_BLEND
SoGLRenderAction.TransparencyTypes.SORTED_OBJECT_BLEND
instead.@Deprecated public static final int SORTED_LAYERS_BLEND
SoGLRenderAction.TransparencyTypes.SORTED_LAYERS_BLEND
instead.@Deprecated public static final int SORTED_PIXELS_BLEND
SoGLRenderAction.TransparencyTypes.SORTED_PIXELS_BLEND
instead.@Deprecated public static final int DELAYED_SORTED_LAYERS_BLEND
SoGLRenderAction.TransparencyTypes.DELAYED_SORTED_LAYERS_BLEND
instead.@Deprecated public static final int DELAYED_SORTED_PIXELS_BLEND
SoGLRenderAction.TransparencyTypes.DELAYED_SORTED_PIXELS_BLEND
instead.@Deprecated public static final int SORTED_TRIANGLES_ADD
SoGLRenderAction.TransparencyTypes.SORTED_TRIANGLES_ADD
instead.@Deprecated public static final int SORTED_TRIANGLES_BLEND
SoGLRenderAction.TransparencyTypes.SORTED_TRIANGLES_BLEND
instead.@Deprecated public static final int SORTED_OBJECT_TRIANGLES_ADD
SoGLRenderAction.TransparencyTypes.SORTED_OBJECT_TRIANGLES_ADD
instead.@Deprecated public static final int SORTED_OBJECT_TRIANGLES_BLEND
SoGLRenderAction.TransparencyTypes.SORTED_OBJECT_TRIANGLES_BLEND
instead.@Deprecated public static final int NO_TRANSPARENCY
SoGLRenderAction.TransparencyTypes.NO_TRANSPARENCY
instead.@Deprecated public static final int DISABLE
SoGLRenderAction.FastEditSavePolicies.DISABLE
instead.@Deprecated public static final int EACH_FRAME
SoGLRenderAction.FastEditSavePolicies.EACH_FRAME
instead.@Deprecated public static final int WHEN_NEEDED
SoGLRenderAction.FastEditSavePolicies.WHEN_NEEDED
instead.@Deprecated public static final int CONTINUE
SoGLRenderAction.AbortCodes.CONTINUE
instead.@Deprecated public static final int ABORT
SoGLRenderAction.AbortCodes.ABORT
instead.@Deprecated public static final int PRUNE
SoGLRenderAction.AbortCodes.PRUNE
instead.@Deprecated public static final int DELAY
SoGLRenderAction.AbortCodes.DELAY
instead.@Deprecated public static final int OFF
SoGLRenderAction.InvalidateCacheModes.OFF
instead.@Deprecated public static final int ONCE
SoGLRenderAction.InvalidateCacheModes.ONCE
instead.@Deprecated public static final int ALWAYS
SoGLRenderAction.InvalidateCacheModes.ALWAYS
instead.@Deprecated public static final int DO_AUTO_CACHE
SoGLRenderAction.AutoCacheModes.DO_AUTO_CACHE
instead.@Deprecated public static final int DONT_AUTO_CACHE
SoGLRenderAction.AutoCacheModes.DONT_AUTO_CACHE
instead.public SoGLRenderAction(SbViewportRegion viewportRegion)
@Deprecated public long getSynchronizer()
public void setPassCallback(SoGLRenderPassCB func)
public void setPassCallback(SoGLRenderPassCB func, java.lang.Object userData)
@Deprecated public void updateTranspList(SoSensor sensor)
@Deprecated public void howToRenderScene(SoSensor sensor, boolean newRender)
public static boolean isSortedLayersSupported()
public boolean handleTransparency()
public void setFastEditSavePolicy(SoGLRenderAction.FastEditSavePolicies policy)
public void resetFrameCounter()
public void setDecimationValue(SoDecimationTypeElement.Types type)
public boolean handleTransparency(boolean isTransparent)
public void setDecimationValue(SoDecimationTypeElement.Types type, float percentage)
public void setTransparencyType(SoGLRenderAction.TransparencyTypes type)
getTransparencyType()
. Transparency handling can be completely disabled by setting NO_TRANSPARENCY.
The global transparency algorithm can also be set using a method in the viewer class (e.g. SoWinRenderArea.setTransparencyType()). The transparency type can also be set for a portion of the scene graph using the SoTransparencyType
node (for all types except SORTED_PIXELS_BLEND and DELAYED_SORTED_PIXELS_BLEND).
The default value for this field can be set using the environment variable OIV_TRANSPARENCY_TYPE.
See SoTransparencyType
for more discussion about transparency.
Notes:
public SoGLRenderAction.TransparencyTypes getTransparencyType()
setTransparencyType()
.public void setUpdateArea(SbVec2f origin, SbVec2f size)
public SbVec2f[] getUpdateArea()
setUpdateArea()
for details.public void resetFrameCounter(int count)
public void setRenderingIsRemote(boolean flag)
public static boolean isUsedCacheContext(int context)
SoGLRenderAction
.public static int generateCacheContext()
setCacheContext()
method call.public void shouldAutoCache(SoGLRenderAction.AutoCacheModes mode)
public boolean getRenderingIsRemote()
public SbViewportRegion getLogicalViewportRegion()
public void setSortedTrianglesSortFrequency(int angle)
The default value for sort frequency is 90, meaning that a sorting is made every 90 degrees. If the value is 0, sorting is always done and the camera orientation vector is the axis used for sorting. In this case, no cache is made.
The allowable angular increments for the sort angle are the integer divisors of 90: { 1, 2, 3, 5, 6, 9, 10, 15, 18, 30, 45, 90 }. If the input value is not an integer divisor of 90, Open Inventor will use the next highest integer divisor of 90.
Examples:
Input values will be clamped to the range 0 to 90.
The following figures show the sort axes used for sort frequencies of 90 degrees and 45 degrees.
public void setInvalidateCacheMode(SoGLRenderAction.InvalidateCacheModes icm)
SoSeparator
node before its children are traversed. No new caches will be built. This value forces all nodes to be visited during each render traversal.
SoSeparator
node before its children are traversed. The invalidate cache mode is automatically changed to OFF at the end of the traversal.
This method is useful to force all nodes to be visited during render traversal.
public float getDecimationPercentage()
public void setSortedTrianglesNumCaches(int numCaches)
When computing a new list of sorted triangles, if an empty cache is available, it is used. Else, the farthest axis from the camera orientation axis is replaced in the cache. The default number of caches is 3.
public int getSortedTrianglesSortFrequency()
public int getSortedTrianglesNumCaches()
public SoGLRenderAction.InvalidateCacheModes getInvalidateCacheMode()
public void setViewportRegion(SbViewportRegion newRegion)
public SbViewportRegion getViewportRegion()
public void setLogicalViewportRegion(SbViewportRegion newLogicalRegion)
public SoDecimationTypeElement.Types getDecimationType()
public int getFrameCounter()
public void setUpState()
setUpState
in class SoAction
public void setNumPasses(int num)
The default value can be set using the environment variable OIV_NUM_RENDER_PASSES.
NOTE: Multipass antialiasing can have very poor performance for large scenes. Full-scene antialiasing (multi-sample) is strongly recommended when the hardware supports it. See SoSceneManager
and SoFullSceneAntialiasing
.
public void setDelayedObjDepthWrite(boolean flag)
public void setPassUpdate(boolean flag)
public boolean handleTransparency(boolean isTransparent, boolean isLinesOrPoints)
public int getNumPasses()
public boolean isSmoothing()
public SoGLRenderAction.FastEditSavePolicies getFastEditSavePolicy()
public void postDelayedTraversal()
postDelayedTraversal
in class SoAction
public void setFastEditSavePolicy(SoGLRenderAction.FastEditSavePolicies policy, boolean fastEditDelayedObjects)
SoSeparator
.
If fastEditDelayedObjects is set to true, delayed objects won't be redrawn when editing the scene graph. It means that the composition between delayed transparent objects and the fast edit scene graph won't be correct, but rendering will be much faster if there are a lot of transparent objects.
Limitations: Using fast edit can lead to visual artifacts when overlay support is enabled. In this case, we recommend to set the OIV_BUFFER_REGION_ENABLE environment variable to 0. The rendering performance of fast edit will be somewhat lower, but resulting rendering will be correct.
public boolean getDelayedObjDepthWrite()
public void setSmoothing(boolean smooth)
The default value can be set using the environment variable OIV_GL_SMOOTHING (0 = false, 1 = true).
public boolean preDelayedTraversal()
preDelayedTraversal
in class SoAction
public boolean abortNow()
public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
public int getSortedLayersNumPasses()
SORTED_PIXELS_BLEND
.public boolean isDoingDepthPeeling()
public boolean isAlphaTest()
public static boolean isSortedLayersSupported(SoState state)
SORTED_PIXELS_BLEND
transparency is supported by your graphics board on the current context.public void setAlphaTest(boolean flag)
For example, if rendering with textures containing "binary" alpha values (0 or 1), the alpha test may be faster than blended transparency and does not require the use of delayed rendering transparency types.
The default value can be set using the environment variable OIV_ALPHA_TEST (0 = false, 1 = true).
public void setSortedLayersNumPasses(int num)
SORTED_PIXELS_BLEND
or DELAYED_SORTED_PIXELS_BLEND
.
Default is 4.
Note: Since Open Inventor 9.4, if the hardware supports the necessary OpenGL features, these transparency modes are implemented using a single-pass, order-independent fragment sorting (A-buffer) algorithm. Therefore the value of this field is not used except in two special cases:
SoVolumeRender
) is combined with geometry rendering, then multiple layers of transparency information are required and this field specifies the number of layers.
Use more passes for more correct transparency. Usually four passes (which is the default value) gives good results. For example, the number of passes needed for rendering an opaque sphere behind two cubes is the number of planes separating the sphere from the viewer (plus 1 in SORTED_PIXELS_BLEND
). So, when backface culling is enabled, 2 faces separate the sphere from the viewer: the front face of the first cube and the front face of the second cube. The number of passes needed in this case is 3 in SORTED_PIXELS_BLEND
and 2 in DELAYED_SORTED_PIXELS_BLEND
.
The default value for this field can be set using the environment variable OIV_NUM_SORTED_LAYERS_PASSES.
public void setCacheContext(int context)
generateCacheContext()
. Note: The value 0xFFFFFFFF (~0) is reserved to represent an undefined id.public int getCurPass()
public boolean isPassUpdate()
public int getDepthPeelingPass()
public int getCacheContext()
public void enableDepthPeeling3D(boolean flag)
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com