SoGLRenderAction Class Reference
[Actions]

Renders a scene graph using OpenGL. More...

#include <Inventor/actions/SoGLRenderAction.h>

Inheritance diagram for SoGLRenderAction:
SoAction SoTypedObject SoBoxHighlightRenderAction SoLineHighlightRenderAction

List of all members.

Public Types

enum  TransparencyType {
  SCREEN_DOOR = SoTransparencyType::SCREEN_DOOR,
  ADD = SoTransparencyType::ADD,
  BLEND = SoTransparencyType::BLEND,
  DELAYED_ADD = SoTransparencyType::DELAYED_ADD,
  DELAYED_BLEND = SoTransparencyType::DELAYED_BLEND,
  SORTED_OBJECT_ADD = SoTransparencyType::SORTED_OBJECT_ADD,
  SORTED_OBJECT_BLEND = SoTransparencyType::SORTED_OBJECT_BLEND,
  SORTED_TRIANGLES_ADD = SoTransparencyType::SORTED_TRIANGLES_ADD,
  SORTED_TRIANGLES_BLEND = SoTransparencyType::SORTED_TRIANGLES_BLEND,
  SORTED_OBJECT_TRIANGLES_ADD = SoTransparencyType::SORTED_OBJECT_TRIANGLES_ADD,
  SORTED_OBJECT_TRIANGLES_BLEND = SoTransparencyType::SORTED_OBJECT_TRIANGLES_BLEND,
  SORTED_PIXELS_BLEND = SoTransparencyType::SORTED_PIXELS_BLEND,
  SORTED_LAYERS_BLEND = SORTED_PIXELS_BLEND,
  DELAYED_SORTED_PIXELS_BLEND = SoTransparencyType::DELAYED_SORTED_PIXELS_BLEND,
  DELAYED_SORTED_LAYERS_BLEND = DELAYED_SORTED_PIXELS_BLEND,
  NO_TRANSPARENCY = SoTransparencyTypeElement::NO_TRANSPARENCY
}
enum  FastEditSavePolicy {
  DISABLE,
  EACH_FRAME,
  WHEN_NEEDED
}
enum  AbortCode {
  CONTINUE,
  ABORT,
  PRUNE,
  DELAY
}
enum  InvalidateCacheMode {
  OFF,
  ONCE,
  ALWAYS
}
typedef AbortCode SoGLRenderAbortCB (void *userData)

Public Member Functions

virtual SoType getTypeId () const
 SoGLRenderAction (const SbViewportRegion &viewportRegion)
void setViewportRegion (const SbViewportRegion &newRegion)
const SbViewportRegiongetViewportRegion () const
void setLogicalViewportRegion (const SbViewportRegion &newLogicalRegion)
const SbViewportRegiongetLogicalViewportRegion () const
void setUpdateArea (const SbVec2f &origin, const SbVec2f &size)
void getUpdateArea (SbVec2f &origin, SbVec2f &size) const
void setAbortCallback (SoGLRenderAbortCB *func, void *userData)
void setTransparencyType (TransparencyType type)
TransparencyType getTransparencyType () const
void setFastEditSavePolicy (FastEditSavePolicy policy, SbBool fastEditDelayedObjects=FALSE)
FastEditSavePolicy getFastEditSavePolicy () const
void setSmoothing (SbBool smooth)
SbBool isSmoothing () const
void setNumPasses (int num)
int getNumPasses () const
void setPassUpdate (SbBool flag)
SbBool isPassUpdate () const
void setPassCallback (SoGLRenderPassCB *func, void *userData)
void setCacheContext (uint32_t context)
uint32_t getCacheContext () const
void setSortedLayersNumPasses (int num)
int getSortedLayersNumPasses () const
void setAlphaTest (SbBool flag)
SbBool isAlphaTest () const
void setRenderingIsRemote (SbBool flag)
SbBool getRenderingIsRemote () const
virtual void invalidateState ()
void setDecimationValue (SoDecimationTypeElement::Type type, float percentage=1.0)
SoDecimationTypeElement::Type getDecimationType ()
float getDecimationPercentage ()
void setSortedTrianglesSortFrequency (int angle)
int getSortedTrianglesSortFrequency ()
void setSortedTrianglesNumCaches (int numCaches)
int getSortedTrianglesNumCaches ()
void setInvalidateCacheMode (InvalidateCacheMode icm)
InvalidateCacheMode getInvalidateCacheMode ()
uint32_t getFrameCounter () const
void resetFrameCounter (uint32_t count=0)

Static Public Member Functions

static SoType getClassTypeId ()
static uint32_t generateCacheContext ()
static bool isUsedCacheContext (uint32_t context)
static SbBool isSortedLayersSupported (SoState *state=NULL)

Detailed Description

Renders a scene graph using OpenGL.

This class traverses a scene graph and renders it using the OpenGL graphics library. It assumes that a valid window has been created and initialized for proper OpenGL rendering. The SoWinRenderArea class or any of its subclasses may be used to create such a window.

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:

The general rendering order is:

  1. Scene graph traversal
    All objects not in one of the following categories, specifically including transparent objects using the SCREEN_DOOR, ADD, or BLEND transparency types.

  2. FastEdit KEEP_ZBUFFER objects
    Objects under an SoSeparator node with fastEditing field set to KEEP_ZBUFFER.

  3. Opaque delayed objects

  4. Transparent delayed objects
    Objects using transparency types DELAYED_BLEND or DELAYED_ADD. Note that by default the OpenGL depth buffer is not updated while rendering these objects.

  5. Transparent sorted objects
    Objects using transparency types SORTED_OBJECT_BLEND or SORTED_OBJECT_ADD. These objects are sorted by the distance of their bounding box from the camera, then rendered in back-to-front order. Note that by default the OpenGL depth buffer is not updated while rendering these objects.

  6. Transparent sorted triangles by object
    Objects using transparency types SORTED_OBJECT_TRIANGLES_ADD or SORTED_OBJECT_TRIANGLES_BLEND. First, objects are sorted according to their projected position on the current sorting axis. Then the triangles are sorted within each object and rendered object by object.

  7. Transparent sorted triangles
    Objects using transparency types SORTED_TRIANGLES_ADD or SORTED_TRIANGLES_BLEND. All of the triangles for all of the objects in the scene are sorted according to their projected position on the current sorting axis. The triangles are rendered in order, triangle by triangle, regardless of the object they belong to.

  8. Annotation delayed objects
    Objects under an SoAnnotation node.

  9. FastEdit CLEAR_ZBUFFER objects
    Objects under an SoSeparator node with fastEditing field set to CLEAR_ZBUFFER.

  10. Front buffer objects
    Objects under an SoFrontBufferGroup (after the buffer swap).

Elements
Sets: SoDecimationTypeElement, SoDecimationPercentageElement, SoGLUpdateAreaElement, SoGLRenderPassElement, SoViewportRegionElement, SoLogicalViewportElement

SEE ALSO

SoSeparator, SoWinRenderArea

See related examples:

FeaturesAlternateRep, FeaturesCorrectTransp, DemoOffscreenStereo


Member Typedef Documentation

Callback functions for render abort should be of this type.

This typedef is defined within the class, since it needs to refer to the AbortCode enumerated type.


Member Enumeration Documentation

Possible return codes from a render abort callback.

Enumerator:
CONTINUE 

Continue traversal as usual.

ABORT 

Stop traversing the rest of the graph.

PRUNE 

Do not traverse this node or its children, but continue.

DELAY 

Delay rendering of this node until the second pass.

Fast edit traversal types.

See SoSeparator for additional info on fast editing.
In the following description, we will call FE the sub-scene graph allowing the fast editing feature,
and NFE the non-fast editing sub-scene graph and consider the following scene graph:

     Separator {
       Separator {
	       fastEditing # ( != DISABLE to activate )
         Translation {}
         Cube{}
       }
       Separator {
         Translation {} Sphere{}
         Translation {} Sphere{}
         Translation {} Sphere{}
       }
     }
     
Enumerator:
DISABLE 

Fast editing is disabled.


FE_Disable.jpg


EACH_FRAME 

The fast edit feature is available.

The image buffer (and possibly the depth buffer, depending on the value of the SoSeparator::fastEditing field) is saved each time the scene graph is redrawn.

We recommend using the EACH_FRAME flag when manipulating a very large main scene graph. In this case, the time used for saving the buffer(s) is insignificant compared to the time to draw the scene. EACH_FRAME is recommended as well when the fast editing sub-scene graph is frequently modified: the user interactivity is better with the fast edit sub-scene graph even though the global scene frame rate may slow down.

FE_Each_Frame.jpg


WHEN_NEEDED 

The fast edit feature is available.

No buffer save is made during ordinary scene rendering. When a change to the fast editing sub-scene graph occurs, the entire scene is first rendered and saved, and then the fast edit nodes are drawn. During the next rendering, only the fast edit nodes are drawn. So, using this flag implies you need one more full scene rendering before starting to move your fast edit sub-scene graph interactively. It would be better to use WHEN_NEEDED when the fast editing sub-scene graph changes very rarely. In this case you will be able to render the scene at full speed because extra time will not be spent saving the image buffer.

FE_When_Needed.jpg


Invalidate cache mode.

Enumerator:
OFF 

(Default) Render caches are handled normally.

See setInvalidateCacheMode().

ONCE 

Render caches are invalidated for each SoSeparator node before its children are traversed.

The invalidate cache mode is automatically set to OFF after traversal. See setInvalidateCacheMode().

ALWAYS 

Render caches are invalidated for each SoSeparator node before its children are traversed.

See setInvalidateCacheMode().

Transparency rendering algorithm.

See setTransparencyType() method.

Enumerator:
SCREEN_DOOR 

Uses stipple patterns to simulate transparency.
Note: This algorithm is very fast because it does not require blending, shaders or sorting. However most applications should use one of the other algorithms. Screen door rendering is low quality and only works for polygons with a single transparency (alpha) value for the entire face. Screen door does not correctly handle the case of transparency per vertex or transparent textures.

ADD 

Uses additive alpha blending.

BLEND 

Uses multiplicative alpha blending.

DELAYED_ADD 

Uses additive blending, rendering all transparent objects after opaque ones.
Note: When using this algorithm the OpenGL depth buffer is not updated (depth buffer writes are disabled) while rendering transparent objects. As a result complex 3D shapes may not be rendered correctly.

DELAYED_BLEND 

Uses multiplicative alpha blending, rendering all transparent objects after opaque ones.
Note: When using this algorithm the OpenGL depth buffer is not updated (depth buffer writes are disabled) while rendering transparent objects. As a result complex 3D shapes may not be rendered correctly.

SORTED_OBJECT_ADD 

Same as DELAYED_ADD, but sorts transparent objects by distances of bounding boxes from camera.

SORTED_OBJECT_BLEND 

Same as DELAYED_BLEND, but sorts transparent objects by distances of bounding boxes from camera.

SORTED_TRIANGLES_ADD 

Renders all the transparent triangles of the scene using additive blending. All of the transparent triangles of all objects of the scene are collected, and then sorted by triangle position.

SORTED_TRIANGLES_BLEND 

Same as SORTED_TRIANGLES_ADD, but uses multiplicative alpha blending.

SORTED_OBJECT_TRIANGLES_ADD 

Renders all the transparent triangles of the scene using additive blending. All of the triangles of all transparent objects of the scene are collected and then sorted by object.

SORTED_OBJECT_TRIANGLES_BLEND 

Same as SORTED_OBJECT_TRIANGLES_ADD, but uses multiplicative alpha blending.

SORTED_PIXELS_BLEND 

Uses a fragment-level depth sorting technique. This mode generally gives the best results for complex transparent objects.Since Open Inventor 9.4, if the hardware supports the necessary OpenGL features, this transparency mode (and DELAYED_SORTED_PIXELS_BLEND) is implemented using a single-pass, order-independent fragment sorting (K-buffer or A-buffer) algorithm. The required OpenGL hardware features are: shader_image_load_store, shader_atomic_counters and shading_language_420pack. These features are standard in core OpenGL 4.2. Use SoGLExtension, if necessary, to check if they are supported.If the hardware does not support single-pass transparency, then a multi-pass "depth peeling" algorithm is used. The required OpenGL hardware features are: Multi-Texture, Texture Environment Combine, Depth texture, and Shadow . These features are standard starting with OpenGL 1.4. The method setSortedLayersNumPasses() allows you to set the number of rendering passes for more correct transparency. Usually, four passes gives good results.If the graphics board does not support multi-pass transparency, SORTED_OBJECT_BLEND is used.Note: If the application uses fragment sorting transparency and specifies a custom fragment shader, the application shader must call an Open Inventor GLSL method instead of setting gl_FragColor directly. In the SDK installation, see shaders/include/Inventor/oivDepthPeeling_frag.hLimitations:

  • This transparency type is not compatible with interlaced stereo.
  • Texturing on transparent objects is limited to one texture.
  • Using the single-pass algorithm, it is possible to run out of GPU memory for storing fragment transparency values. This should only happen for scenes with both high depth complexity and a large number of transparent objects. In this case fragments from the objects traversed last in the scene graph may not be sorted correctly, resulting in small artifacts.

SORTED_LAYERS_BLEND 

Deprecated name of SORTED_PIXELS_BLEND.

Deprecated:

Deprecated since Open Inventor 9400
It corresponds to the SORTED_PIXELS_BLEND transparency type.

DELAYED_SORTED_PIXELS_BLEND 

Same as SORTED_PIXELS_BLEND but rendering all transparent objects after opaque ones.

DELAYED_SORTED_LAYERS_BLEND 

Deprecated name of DELAYED_SORTED_PIXELS_BLEND.

Deprecated:

Deprecated since Open Inventor 9400
It corresponds to the DELAYED_SORTED_PIXELS_BLEND transparency type.

NO_TRANSPARENCY 

Draw all objects as opaque ignoring their transparency.


Constructor & Destructor Documentation

SoGLRenderAction::SoGLRenderAction ( const SbViewportRegion viewportRegion  ) 

Constructor.

The parameter defines the viewport region into which rendering will take place.


Member Function Documentation

static uint32_t SoGLRenderAction::generateCacheContext (  )  [static]

Generates and returns a new cache context id.

The returned cache context id can then be used to pass to the setCacheContext() method call.

uint32_t SoGLRenderAction::getCacheContext (  )  const

Returns the OpenGL cache context id for this action.

static SoType SoGLRenderAction::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoAction.

Reimplemented in SoBoxHighlightRenderAction, and SoLineHighlightRenderAction.

float SoGLRenderAction::getDecimationPercentage (  )  [inline]

Gets decimation percentage, the value should be a number between 0.0 and 1.0.

SoDecimationTypeElement::Type SoGLRenderAction::getDecimationType (  )  [inline]

Gets decimation type.

FastEditSavePolicy SoGLRenderAction::getFastEditSavePolicy (  )  const [inline]

Returns fast editing save policy used when rendering.

uint32_t SoGLRenderAction::getFrameCounter (  )  const [inline]

Returns the current frame counter.

The frame counter starts at zero and is automatically incremented each time the action is applied. The frame counter will have the same value throughout a single apply, even if there are multiple render passes, delayed rendering, etc.

InvalidateCacheMode SoGLRenderAction::getInvalidateCacheMode (  ) 

Returns the current cache invalidation mode.

const SbViewportRegion& SoGLRenderAction::getLogicalViewportRegion (  )  const [inline]

Returns current logical viewport region.

int SoGLRenderAction::getNumPasses (  )  const [inline]

Gets number of rendering passes for multipass rendering.

SbBool SoGLRenderAction::getRenderingIsRemote (  )  const

Returns TRUE if remote rendering is being done.

int SoGLRenderAction::getSortedLayersNumPasses (  )  const [inline]

Returns the number of rendering passes used when transparency type is SORTED_PIXELS_BLEND.

int SoGLRenderAction::getSortedTrianglesNumCaches (  ) 

Returns the maximum number of caches allowed for the sorted triangles transparency types.

int SoGLRenderAction::getSortedTrianglesSortFrequency (  ) 

Returns the sort frequency used for the SORTED_TRIANGLES_XXX and SORTED_OBJECT_TRIANGLES_XXX transparency types.

TransparencyType SoGLRenderAction::getTransparencyType (  )  const [inline]

Returns transparency quality level to use when rendering.

See setTransparencyType().

virtual SoType SoGLRenderAction::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Implements SoTypedObject.

Reimplemented in SoBoxHighlightRenderAction, and SoLineHighlightRenderAction.

void SoGLRenderAction::getUpdateArea ( SbVec2f origin,
SbVec2f size 
) const

Returns the current update area.

See setUpdateArea() for details.

const SbViewportRegion& SoGLRenderAction::getViewportRegion (  )  const [inline]

Returns viewport region to use for rendering.

virtual void SoGLRenderAction::invalidateState (  )  [virtual]

Invalidate the state, forcing it to be recreated at the next apply.

Reimplemented from SoAction.

SbBool SoGLRenderAction::isAlphaTest (  )  const [inline]

Returns whether the OpenGL alpha test is enabled for rendering.

SbBool SoGLRenderAction::isPassUpdate (  )  const [inline]

Returns a flag indicating whether intermediate results are displayed after each antialiasing pass for progressive improvement.

The default value can be set using the environment variable OIV_ANTIALIAS_PASS_UPDATE.

SbBool SoGLRenderAction::isSmoothing (  )  const [inline]

Returns smoothing flag.

static SbBool SoGLRenderAction::isSortedLayersSupported ( SoState state = NULL  )  [static]

Indicates if SORTED_PIXELS_BLEND transparency is supported by your graphics board on the current context.

static bool SoGLRenderAction::isUsedCacheContext ( uint32_t  context  )  [static]

Returns TRUE if the specified cache context id is currently used by any SoGLRenderAction.

void SoGLRenderAction::resetFrameCounter ( uint32_t  count = 0  )  [inline]

Reset the frame counter.

Do not call this method during a traversal.

void SoGLRenderAction::setAbortCallback ( SoGLRenderAbortCB func,
void *  userData 
) [inline]

Sets callback to call during rendering to test for an abort condition.

It will be called for each node that is traversed. This allows applications to terminate rendering prematurely if some condition occurs. The callback function should return one of the AbortCode codes to indicate whether traversal should continue. Use of the various codes in a callback can allow applications to modify Open Inventor's default order of rendering objects in a scene graph.

void SoGLRenderAction::setAlphaTest ( SbBool  flag  ) 

Enable or disable the OpenGL alpha test for rendering.

Default is FALSE (alpha test disabled) and the default test is "not equal to zero". The alpha test operates on all pixel writes, including those resulting from the scan conversion of points, lines, polygons, and bitmaps, and from pixel draw and copy operations. It does not affect screen clear operations.

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).

void SoGLRenderAction::setCacheContext ( uint32_t  context  ) 

Sets the OpenGL cache context.

A cache context is just an integer identifying when OpenGL display lists (which are used for render caching) can be shared between render actions; for example, see the documentation on GLX contexts for information on when OpenGL display lists can be shared between GLX windows. See generateCacheContext(). Note: The value 0xFFFFFFFF (~0) is reserved to represent an undefined id.

void SoGLRenderAction::setDecimationValue ( SoDecimationTypeElement::Type  type,
float  percentage = 1.0 
)

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 SoGLRenderAction::setFastEditSavePolicy ( FastEditSavePolicy  policy,
SbBool  fastEditDelayedObjects = FALSE 
)

Sets fast editing save policy to use when rendering.

The default is WHEN_NEEDED. Valid values are DISABLE, EACH_FRAME, and WHEN_NEEDED. See 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.

void SoGLRenderAction::setInvalidateCacheMode ( InvalidateCacheMode  icm  ) 

Enables or disables the invalidation of render caches.

  • When set to ALWAYS, the caches are invalidated for each 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.
  • When set to ONCE, the caches are invalidated for each SoSeparator node before its children are traversed. The invalidate cache mode is automatically changed to OFF at the end of the traversal.
  • When set to OFF (default), caches are managed by their respective render caching nodes in the usual way.

This method is useful to force all nodes to be visited during render traversal.

void SoGLRenderAction::setLogicalViewportRegion ( const SbViewportRegion newLogicalRegion  ) 

Sets current logical viewport region to use for rendering.

Setting an empty viewport region (0,0) unsets the logical viewport.

void SoGLRenderAction::setNumPasses ( int  num  ) 

Sets number of rendering passes for multipass antialiasing.

The default is 1. Specifying more than one pass will result in antialiasing of the rendered scene, using OpenGL's accumulation buffer. (Camera nodes typically move their viewpoints a little bit for each pass to achieve the antialiasing.) Each additional pass provides better antialiasing, but requires more rendering time.

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.

void SoGLRenderAction::setPassCallback ( SoGLRenderPassCB func,
void *  userData 
) [inline]

Sets a callback function to invoke between passes when antialiasing.

Passing NULL (which is the default state) will cause a clear of the color and depth buffers to be performed.

void SoGLRenderAction::setPassUpdate ( SbBool  flag  )  [inline]

Sets a flag indicating whether intermediate results are displayed after each antialiasing pass for progressive improvement (default is FALSE).

void SoGLRenderAction::setRenderingIsRemote ( SbBool  flag  ) 

Sets whether or not "remote" rendering is done.

Inventor's auto-render-caching algorithm will choose to cache more often when rendering is remote (the assumption being that performance will be better with display lists stored on the remote machine). By default, it is assumed rendering is NOT remote.

void SoGLRenderAction::setSmoothing ( SbBool  smooth  ) 

Sets smoothing flag.

When on, smoothing uses OpenGL's line- and point-smoothing features to provide cheap antialiasing of lines and points. Smoothing is required to render points as circles instead of squares. The default is FALSE.

The default value can be set using the environment variable OIV_GL_SMOOTHING (0 = FALSE, 1 = TRUE).

void SoGLRenderAction::setSortedLayersNumPasses ( int  num  )  [inline]

Sets the number of rendering passes used when transparency type is 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:

  • If hardware support for single pass transparency is not available, then the previous "depth peeling" algorithm is used (which normally requires multiple passes), or
  • If volume rendering (see 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.

void SoGLRenderAction::setSortedTrianglesNumCaches ( int  numCaches  ) 

Sets the number of caches to use when the transparency type is SORTED_TRIANGLES_XXX or SORTED_OBJECT_TRIANGLES_XXX.

This specifies the number of lists of sorted triangles to keep in memory in order to render transparent triangles more quickly.

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.

void SoGLRenderAction::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.


Transparent triangles are sorted based on the nearest axis. (in terms of the dot (inner) product). If the triangles have already been sorted on this axis (or the opposite), and the sort result is cached, the triangles are rendered using the cached information.

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:

  • angle=67 => sort axes every 90 degrees
  • angle=45 => sort axes every 45 degrees
  • angle=37 => sort axes every 45 degrees

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.

angle90.gif
angle45.gif
void SoGLRenderAction::setTransparencyType ( TransparencyType  type  ) 

Sets global transparency algorithm to use when rendering.

Use enum TransparencyType. The default is SCREEN_DOOR, but SORTED_PIXELS_BLEND is recommended for most cases. See also 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:

  • SCREEN_DOOR is very fast because it does not require blending, shaders or sorting. However most applications should use one of the other algorithms. Screen door rendering is low quality and only works for polygons with a single transparency (alpha) value for the entire face. Screen door does not correctly handle the case of transparency per vertex or transparent textures.
  • When using transparency types with DELAYED in the name, the depth buffer is not updated (depth buffer writes are disabled) while rendering transparent objects. As a result complex 3D shapes may not be rendered correctly.
  • When using a delayed transparency mode, paths to transparent objects are saved in a list. After all opaque objects have been rendered, this list is rendered. In order to avoid unnecessary rendering, the common part of each path is rendered only once. This can increase performance on very complex scene graphs. However, in some cases, it can lead to incorrect rendering. In the figure below, node B is a transparent object and node A has a side effect on node B (clipping, shader...). When the compact path optimization is on (the default), node A will not be traversed during the transparency pass, which will lead to incorrect rendering. When a case like this occurs in your scene graph, set the environment variable OIV_USE_COMPACT_PATHS to false to disable this optimization.
    CompactPathList.png

void SoGLRenderAction::setUpdateArea ( const SbVec2f origin,
const SbVec2f size 
)

Sets the current update area, which is the rectangular area of the viewport region that will actually be rendered into.

This can be used for partial updates in applications that can manage them. The update area is specified in normalized viewport coordinates, where (0,0) is the lower left corner of the viewport and (1,1) is the upper right corner. The area is specified or returned as an origin and a size.

void SoGLRenderAction::setViewportRegion ( const SbViewportRegion newRegion  ) 

Changes viewport region to use for rendering.


The documentation for this class was generated from the following file:

Open Inventor by FEI reference manual, generated on 21 Sep 2015
Copyright © FEI S.A.S. All rights reserved.
http://www.vsg3d.com