#include <Inventor/actions/SoGLRenderAction.h>
Inheritance diagram for SoGLRenderAction:
Public Types | |
typedef AbortCode | SoGLRenderAbortCB (void *userdata) |
enum | TransparencyType { SCREEN_DOOR, ADD, DELAYED_ADD, SORTED_OBJECT_ADD, BLEND, DELAYED_BLEND, SORTED_OBJECT_BLEND, SORTED_OBJECT_SORTED_TRIANGLE_ADD, SORTED_OBJECT_SORTED_TRIANGLE_BLEND } |
enum | AbortCode { CONTINUE, ABORT, PRUNE, DELAY } |
Public Member Functions | |
SoGLRenderAction (const SbViewportRegion &viewportregion) | |
virtual | ~SoGLRenderAction () |
void | setViewportRegion (const SbViewportRegion &newregion) |
const SbViewportRegion & | getViewportRegion (void) const |
void | setUpdateArea (const SbVec2f &origin, const SbVec2f &size) |
void | getUpdateArea (SbVec2f &origin, SbVec2f &size) const |
void | setAbortCallback (SoGLRenderAbortCB *const func, void *const userdata) |
void | setTransparencyType (const TransparencyType type) |
TransparencyType | getTransparencyType (void) const |
void | setSmoothing (const SbBool smooth) |
SbBool | isSmoothing (void) const |
void | setNumPasses (const int num) |
int | getNumPasses (void) const |
void | setPassUpdate (const SbBool flag) |
SbBool | isPassUpdate (void) const |
void | setPassCallback (SoGLRenderPassCB *const func, void *const userdata) |
void | setCacheContext (const uint32_t context) |
uint32_t | getCacheContext (void) const |
void | addDelayedPath (SoPath *path) |
SbBool | isRenderingDelayedPaths (void) const |
SbBool | handleTransparency (SbBool istransparent=FALSE) |
int | getCurPass (void) const |
SbBool | abortNow (void) |
void | setRenderingIsRemote (SbBool isremote) |
SbBool | getRenderingIsRemote (void) const |
virtual void | invalidateState (void) |
void | addPreRenderCallback (SoGLPreRenderCB *func, void *userdata) |
void | removePreRenderCallback (SoGLPreRenderCB *func, void *userdata) |
Static Public Member Functions | |
void | initClass (void) |
Protected Member Functions | |
virtual void | beginTraversal (SoNode *node) |
virtual void | endTraversal (SoNode *node) |
Applying this method at a root node for a scene graph, path or pathlist will render all geometry contained within that instance to the current OpenGL context.
|
Abort callbacks should be of this type.
|
|
Various settings for how to do rendering of transparent objects in the scene. Some of the settings will provide faster rendering, while others gives you better quality rendering. Note that doing correct rendering of multiple transparent objects often fails, because to be 100% correct, all polygons needs to be rendered in sorted order, and polygons can't intersect each other. In a dynamic scene graph it is often impossible to guarantee that no polygons intersect, and finding an algorithm that does correct sorting of polygons for all possible cases is very hard and time-consuming. The highest quality transparency mode in the original SGI / TGS Open Inventor is SoGLRenderAction::SORTED_OBJECT_BLEND, where all transparent objects are rendered in sorted order in a rendering pass after all opaque objects. However, this mode does not sort the polygons, and if you have an object where some polygon A is behind some other polygon B, the transparency will only be correct if A happens to be rendered before B. For other camera angles, where B is behind A, the transparency will not be correct. In Coin we have a new transparency mode that solves some of these problems: SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_BLEND. In addition to sorting the objects, all polygons inside each object is also sorted back-to-front when rendering. But, if you have intersecting objects and/or intersecting polygons, even this transparency mode will fail. Also, because of the polygon sorting, this transparency mode is quite slow. In Coin version 2 we introduced a new node which makes it possible to speed things up. Using the SoTransparencyType node, it enables you to set different transparency modes for different parts of the scene graph. If you have only have a few objects where you need to sort the polygons, you can use SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_BLEND for those, and for instance SoGLRenderAction::SORTED_OBJECT_BLEND for all other transparent objects.
|
|
The return codes which an SoGLRenderAbortCB callback function should use.
|
|
Constructor. Sets up the render action for rendering within the given viewportregion. |
|
Destructor, frees up all internal resources for action instance. |
|
Initializes the run-time type system for this class, and sets up the enabled elements and action method list. Reimplemented from SoAction. Reimplemented in SoBoxHighlightRenderAction, and SoLineHighlightRenderAction. |
|
Sets the viewport region for rendering. This will then override the region passed in with the constructor. |
|
Returns the viewport region for the rendering action. |
|
Sets the area of the OpenGL context canvas we should render into. The coordinates for origin and size should be normalized to be within [0.0, 1.0]. The default settings are <0.0, 0.0> for the origin and <1.0, 1.0> for the size, using the full size of the rendering canvas. |
|
Returns information about the area of the rendering context window to be updated. |
|
Sets the abort callback. The abort callback is called by the action for each node during traversal to check for abort conditions. The callback method should return one of the SoGLRenderAction::AbortCode enum values to indicate how the action should proceed further. Since the client SoGLRenderAbortCB callback function only has a single void* argument for the userdata, one has to do some additional work to find out which node the callback was made for. One can do this by for instance passing along the action pointer as userdata, and then call the SoGLRenderAction::getCurPath() method. The tail of the path will then be the last traversed node. Like this:
|
|
Sets the transparency rendering method for transparent objects in the scene graph.
|
|
Returns the transparency rendering type. |
|
Sets (or unsets) smoothing. If the smoothing flag is This is a simple (and computationally non-intensive) way of doing anti-aliasing.
Default value for this flag is to be |
|
Returns whether smoothing is set or not. |
|
Sets the number of rendering passes. Default is 1, anything greater will enable antialiasing. |
|
Returns the number of rendering passes done on updates. |
|
Sets whether each pass should render to screen or not. |
|
Returns the value of the "show intermediate updates" flag.
|
|
Sets the pass callback. The callback is called between each rendering pass. |
|
Sets the OpenGL cache context key, which is used for deciding when to share OpenGL display lists. Each SoGLRenderAction has a cache context id. This can be set using SoGLRenderAction::setCacheContext(). The cache context id must be unique, so that different texture objects and display lists are created for uncompatible GL contexts. For instance, when SoGLRenderAction traverses an SoTexture2 node, the node checks if it has a texture object created for the cache context. If not, a new texture object will be created and used when rendering.
|
|
Returns the cache context key for this rendering action instance. |
|
Adds a path to the list of paths to render after the current pass. |
|
Returns a flag indicating whether or not we are currently rendering from the list of delayed paths of the scene graph. |
|
Used by shape nodes or others which need to know whether or not they should immediately render themselves or if they should wait until the next pass. |
|
Returns the number of the current rendering pass. |
|
Returns
|
|
Let SoGLRenderAction instance know if application is running on the local machine or if the rendering instructions are sent over the network. The flag is used to optimize rendering. For instance should the displaylist caching strategy be influenced by this flag to be more aggressive with the caching when rendering instructions are passed over the network.
Default value is
|
|
Returns whether or not the application is running remotely.
|
|
Invalidates the state, forcing it to be recreated at the next apply() invocation. Reimplemented from SoAction. |
|
Adds a callback which is invoked right before the scene graph traversal starts. All necessary GL initialization is then done (e.g. the viewport is correctly set), and this callback can be useful to, for instance, clear the viewport before rendering, or draw a bitmap in the background before rendering etc. The callback is only invoked once (before the first rendering pass) when multi pass rendering is enabled. Please note that SoSceneManager usually adds a callback to clear the GL buffers in SoSceneManager::render(). So, if you plan to for instance draw an image in the color buffer using this callback, you should make sure that the scene manager doesn't clear the buffer. This can be done either by calling SoSceneManager::render() with both arguments FALSE, or, if you're using one of our GUI toolkits (SoXt/SoQt/SoGtk/SoWin), call setClearBeforeRender() on the viewer. This method is an extension versus the Open Inventor API.
|
|
Removed a callback added with the addPreRenderCallback() method. This method is an extension versus the Open Inventor API.
|
|
This virtual method is called from SoAction::apply(), and is the entry point for the actual scenegraph traversal. It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction. Default method just calls traverse(), which any overridden implementation of the method must do too (or call SoAction::beginTraversal()) to trigger the scenegraph traversal. Reimplemented from SoAction. |
|
This virtual method can be overridden to execute code after the scene graph traversal. Default method does nothing. Reimplemented from SoAction. |