Open Inventor Reference
SoCallback Class Reference

Provides custom behavior during actions. More...

#include <Inventor/nodes/SoCallback.h>

Inheritance diagram for SoCallback:
SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoCallback ()
 Creates a callback node with default settings.
void setCallback (SoCallbackCB *func, void *userData=NULL)
 Sets pointer to callback function and user data.
virtual void doAction (SoAction *action)
 Traversal methods for all the actions:
virtual void callback (SoCallbackAction *action)
virtual void GLRender (SoGLRenderAction *action)
 These virtual functions implement all of the actions for nodes, Most of the default implementations do nothing.
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
virtual void getMatrix (SoGetMatrixAction *action)
virtual void handleEvent (SoHandleEventAction *action)
virtual void pick (SoPickAction *action)
virtual void search (SoSearchAction *action)
virtual void write (SoWriteAction *action)

Static Public Member Functions

static void initClass ()
 Initializes base node class.

Protected Member Functions

virtual ~SoCallback ()
virtual void copyContents (const SoFieldContainer *fromFC, SbBool copyConnections)
 Copies the contents of the given node into this instance.

Detailed Description

This node provides a general mechanism for inserting callback functions into a scene graph. The callback function registered with the node is called each time the node is traversed while performing any scene graph action. The callback function is passed a pointer to the action being performed and a user data pointer registered with the callback function. You can use this node to make nonstandard OpenGL calls while rendering. If you do, be careful not to interfere with Inventor's use of OpenGL.

If you use a callback node for GL rendering, you should be careful to follow render caching rules. If your callback node can make different rendering calls each time it is traversed, it cannot be cached. In such a case, the node should invalidate any open caches, as in the following example:

void
myCallbackFunc(void *d, SoAction *action) {
    if (action->isOfType(SoGLRenderAction::getClassTypeId())) {
        // Make my custom GL calls
        ((MyClass *) d)->myRender();
        
        // Invalidate the state so that a cache is not made
        SoCacheElement::invalidate(action->getState());
    }
}

Action Behavior
SoGLRenderAction, SoBoundingBoxAction, SoPickAction
Calls the specified callback function for all actions.
See Also
SoAction, SoCallbackAction, SoEventCallback

Definition at line 110 of file SoCallback.h.


Constructor & Destructor Documentation

SoCallback::SoCallback ( )
virtual SoCallback::~SoCallback ( ) [protected, virtual]

Member Function Documentation

virtual void SoCallback::callback ( SoCallbackAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCallback::copyContents ( const SoFieldContainer fromFC,
SbBool  copyConnections 
) [protected, virtual]

Reimplemented from SoNode.

virtual void SoCallback::doAction ( SoAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCallback::getBoundingBox ( SoGetBoundingBoxAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCallback::getMatrix ( SoGetMatrixAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCallback::GLRender ( SoGLRenderAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCallback::handleEvent ( SoHandleEventAction action) [virtual]

Reimplemented from SoNode.

static void SoCallback::initClass ( ) [static]

Reimplemented from SoNode.

virtual void SoCallback::pick ( SoPickAction action) [virtual]

Reimplemented from SoNode.

virtual void SoCallback::search ( SoSearchAction action) [virtual]

Reimplemented from SoNode.

void SoCallback::setCallback ( SoCallbackCB func,
void *  userData = NULL 
) [inline]

By default, the function pointer in the node is NULL and does nothing.

Definition at line 121 of file SoCallback.h.

virtual void SoCallback::write ( SoWriteAction action) [virtual]

Reimplemented from SoNode.


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