Open Inventor Reference
|
Renders a scene graph using OpenGL. More...
#include <Inventor/actions/SoGLRenderAction.h>
Public Types | |
enum | TransparencyType { SCREEN_DOOR , ADD , DELAYED_ADD , SORTED_OBJECT_ADD , BLEND , DELAYED_BLEND , SORTED_OBJECT_BLEND } |
Various levels of transparency rendering quality. More... | |
enum | AbortCode { CONTINUE , ABORT , PRUNE , DELAY } |
Possible return codes from a render abort callback. More... | |
typedef AbortCode | SoGLRenderAbortCB(void *userData) |
Callback functions for render abort should be of this type. | |
Public Types inherited from SoAction | |
enum | AppliedCode { NODE , PATH , PATH_LIST } |
This enum is used to determine what the action is being applied to. More... | |
enum | PathCode { NO_PATH , IN_PATH , BELOW_PATH , OFF_PATH } |
This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed. More... | |
Public Member Functions | |
SoGLRenderAction (const SbViewportRegion &viewportRegion) | |
Constructor. | |
virtual | ~SoGLRenderAction () |
Destructor. | |
void | setViewportRegion (const SbViewportRegion &newRegion) |
Changes viewport region to use for rendering. | |
const SbViewportRegion & | getViewportRegion () const |
Returns viewport region to use for rendering. | |
void | setUpdateArea (const SbVec2f &origin, const SbVec2f &size) |
void | getUpdateArea (SbVec2f &origin, SbVec2f &size) const |
Sets/returns the current update area, which is the rectangular area of the viewport region that will actually be rendered into. | |
void | setAbortCallback (SoGLRenderAbortCB *funcArg, void *userData) |
Sets callback to call during rendering to test for an abort condition. | |
void | setTransparencyType (TransparencyType type) |
TransparencyType | getTransparencyType () const |
Sets/returns transparency quality level to use when rendering. | |
void | setSmoothing (bool smooth) |
bool | isSmoothing () const |
Sets/returns smoothing flag. | |
void | setNumPasses (int num) |
int | getNumPasses () const |
Sets/returns number of rendering passes for multipass rendering. | |
void | setPassUpdate (bool flag) |
bool | isPassUpdate () const |
Sets/returns a flag indicating whether intermediate results are displayed after each antialiasing pass for progressive improvement (default is FALSE). | |
void | setPassCallback (SoGLRenderPassCB *funcArg, void *userData) |
Sets a callback function to invoke between passes when antialiasing. | |
void | setCacheContext (uint32_t context) |
uint32_t | getCacheContext () const |
Sets/returns the OpenGL cache context. | |
virtual void | invalidateState () |
Invalidate the state, forcing it to be recreated at the next apply. | |
int | getCurPass () const |
Returns current rendering pass number. | |
bool | abortNow () |
Returns TRUE if render action should abort - checks user callback. | |
bool | handleTransparency (bool isTransparent=FALSE) |
Returns TRUE if render action handles processing of a transparent object (if it is to be sorted and rendered later). | |
bool | isDelaying () const |
Returns TRUE if rendering is being delayed because of transparency sorting or delaying. | |
void | addDelayedPath (SoPath *path) |
Adds to the list of paths to render after all other stuff (including delayed/sorted transparent objects) have been rendered. | |
bool | isRenderingDelayedPaths () const |
Returns TRUE if currently rendering delayed paths. | |
int | getCullTestResults () |
void | setCullTestResults (int b) |
bool | setAllowDelayedPath (bool flag) |
Sets if delayed paths are allowed while rendering. | |
bool | getAllowDelayedPaths () |
Returns if delayed paths are currently allowed. | |
Public Member Functions inherited from SoAction | |
virtual | ~SoAction () |
Destructor. | |
virtual SoType | getTypeId () const =0 |
Returns the type identifier for a specific instance. | |
bool | isOfType (SoType type) const |
Returns TRUE if this instance is of the type specified in type or is derived from that type. | |
virtual void | apply (SoNode *node) |
virtual void | apply (SoPath *path) |
virtual void | apply (const SoPathList &pathList, bool obeysRules=FALSE) |
Initiates an action on the graph defined either by a node, path, or list of paths. | |
virtual void | invalidateState () |
Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied. | |
AppliedCode | getWhatAppliedTo () const |
Returns code indicating what action is being applied to. | |
SoNode * | getNodeAppliedTo () const |
These returns a pointer to the node, path, or path list the action is being applied to. | |
SoPath * | getPathAppliedTo () const |
const SoPathList * | getPathListAppliedTo () const |
A single path list may be split into several, one for each different head node. | |
const SoPathList * | getOriginalPathListAppliedTo () const |
bool | isLastPathListAppliedTo () const |
PathCode | getPathCode (int &numIndices, const int *&indices) |
Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to. | |
void | traverse (SoNode *node) |
Does traversal of a graph rooted by a node. | |
bool | hasTerminated () const |
Returns TRUE if the traversal has reached a termination condition. | |
const SoPath * | getCurPath () |
Returns a pointer to the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed. | |
SoState * | getState () const |
Get the state from the action. | |
PathCode | getCurPathCode () const |
These methods maintain the current path accumulated so far during traversal. | |
void | pushCurPath (int childIndex) |
void | popCurPath (PathCode prevPathCode) |
virtual SoNode * | getCurPathTail () |
This is virtual, so that SoCallbackAction can use current node. | |
void | usePathCode (int &numIndices, const int *&indices) |
called by inline getPathCode: | |
void | pushCurPath () |
Optimized versions of push/pop when we know path codes won't change: | |
void | popPushCurPath (int childIndex) |
void | popCurPath () |
const SoLightweightPath & | getCurrentLightweightPath () const |
Returns the current "light" path. | |
void | setCurrentLightweightPath (const SoLightweightPath &path) |
Sets the current "light" path. | |
Static Public Member Functions | |
static void | initClass () |
Static Public Member Functions inherited from SoAction | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
static void | nullAction (SoAction *, SoNode *) |
Null action method that can be stored in lookup table when desired. | |
static void | initClass () |
static void | initClasses () |
Initialize ALL Inventor action classes. | |
Protected Member Functions | |
virtual void | beginTraversal (SoNode *node) |
Initiates action on graph. | |
Protected Member Functions inherited from SoAction | |
SoAction () | |
Constructor. | |
virtual const SoEnabledElementsList & | getEnabledElements () const |
Returns the list of enabled elements for a given action subclass. | |
virtual void | beginTraversal (SoNode *node) |
Begins traversal of an action at the given node. | |
void | setTerminated (bool flag) |
Allows subclass instance to indicate that traversal has reached a termination condition. | |
virtual bool | shouldCompactPathLists () const |
This method is used when applying an action to an SoPathList. | |
Additional Inherited Members | |
Protected Attributes inherited from SoAction | |
SoState * | state |
Traversal state. | |
SoActionMethodList * | traversalMethods |
The list of what to do when. | |
Static Protected Attributes inherited from SoAction | |
static SoEnabledElementsList * | enabledElements |
Holds list of enabled elements for the SoAction class. | |
static SoActionMethodList * | methods |
... and the methods | |
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 SoQtRenderArea class or any of its subclasses may be used to create such a window.
Definition at line 86 of file SoGLRenderAction.h.
typedef AbortCode SoGLRenderAction::SoGLRenderAbortCB(void *userData) |
This typedef is defined within the class, since it needs to refer to the AbortCode enumerated type.
Definition at line 114 of file SoGLRenderAction.h.
Enumerator | |
---|---|
CONTINUE | Continue as usual. |
ABORT | Stop traversing the rest of the graph. |
PRUNE | Do not traverse this node or its children. |
DELAY | Delay rendering of this node. |
Definition at line 104 of file SoGLRenderAction.h.
Definition at line 93 of file SoGLRenderAction.h.
SoGLRenderAction::SoGLRenderAction | ( | const SbViewportRegion & | viewportRegion | ) |
The parameter defines the viewport region into which rendering will take place.
|
virtual |
|
inline |
Definition at line 205 of file SoGLRenderAction.h.
References SoAction::hasTerminated().
void SoGLRenderAction::addDelayedPath | ( | SoPath * | path | ) |
(Used for annotation nodes.)
|
protectedvirtual |
Reimplemented from SoAction.
|
inline |
Definition at line 242 of file SoGLRenderAction.h.
uint32_t SoGLRenderAction::getCacheContext | ( | ) | const |
A cache context is just an integer identifying when OpenGL display lists (which are used for render caching) can be shared between render actions.
|
inline |
Definition at line 234 of file SoGLRenderAction.h.
|
inline |
Definition at line 202 of file SoGLRenderAction.h.
|
inline |
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 is 1 pass.
Definition at line 175 of file SoGLRenderAction.h.
|
inline |
The default is SCREEN_DOOR. (Note that SCREEN_DOOR transparency does not work in the case where transparency values are specified for each vertex of a shape. If this is the case, use one of the other transparency types.)
Definition at line 158 of file SoGLRenderAction.h.
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.
|
inline |
Definition at line 128 of file SoGLRenderAction.h.
bool SoGLRenderAction::handleTransparency | ( | bool | isTransparent = FALSE | ) |
If this returns FALSE, the object should just go ahead and render itself. The optional argument isTransparent ensures that the object being rendered will be taken as transparent, regardless of transparency in the state. If it is false, the state is checked for transparency.
|
static |
|
virtual |
Reimplemented from SoAction.
|
inline |
Definition at line 223 of file SoGLRenderAction.h.
|
inline |
Definition at line 182 of file SoGLRenderAction.h.
|
inline |
Definition at line 231 of file SoGLRenderAction.h.
|
inline |
When on, smoothing uses OpenGL's line- and point-smoothing features to provide cheap antialiasing of lines and points. The default is FALSE.
Definition at line 165 of file SoGLRenderAction.h.
|
inline |
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 Inventor's default order of rendering objects in a scene graph.
Definition at line 148 of file SoGLRenderAction.h.
bool SoGLRenderAction::setAllowDelayedPath | ( | bool | flag | ) |
Default is true. Returns the previous setting.
void SoGLRenderAction::setCacheContext | ( | uint32_t | context | ) |
|
inline |
Definition at line 235 of file SoGLRenderAction.h.
|
inline |
Definition at line 168 of file SoGLRenderAction.h.
|
inline |
Passing NULL (which is the default state) will cause a clear of the color and depth buffers to be performed.
Definition at line 187 of file SoGLRenderAction.h.
|
inline |
Definition at line 178 of file SoGLRenderAction.h.
void SoGLRenderAction::setSmoothing | ( | bool | smooth | ) |
void SoGLRenderAction::setTransparencyType | ( | TransparencyType | type | ) |
void SoGLRenderAction::setViewportRegion | ( | const SbViewportRegion & | newRegion | ) |