table of contents
SoCallback(3IV)() | SoCallback(3IV)() |
NAME¶
SoCallback — provides custom behavior during actions
INHERITS FROM¶
SoBase > SoFieldContainer > SoNode > SoCallback
SYNOPSIS¶
#include <Inventor/nodes/SoCallback.h>
typedef void SoCallbackCB(void *userData, SoAction
*action)
Methods from class SoCallback:
SoCallback()
void setCallback(SoCallbackCB *func, void *userData =
NULL)
static SoType getClassTypeId()
Methods from class SoNode:
void setOverride(SbBool state)
SbBool isOverride() const
SoNode * copy(SbBool copyConnections = FALSE)
const
virtual SbBool affectsState() const
static SoNode * getByName(const SbName &name)
static int getByName(const SbName &name,
SoNodeList &list)
Methods from class SoFieldContainer:
void setToDefaults()
SbBool hasDefaultValues() const
SbBool fieldsAreEqual(const SoFieldContainer *fc)
const
void copyFieldValues(const SoFieldContainer *fc,
SbBool copyConnections = FALSE)
SbBool set(const char *fieldDataString)
void get(SbString &fieldDataString)
virtual int getFields(SoFieldList &resultList)
const
virtual SoField * getField(const SbName
&fieldName) const
SbBool getFieldName(const SoField *field, SbName
&fieldName) const
SbBool isNotifyEnabled() const
SbBool enableNotify(SbBool flag)
Methods from class SoBase:
void ref()
void unref() const
void unrefNoDelete() const
void touch()
virtual SoType getTypeId() const
SbBool isOfType(SoType type) const
virtual void setName(const SbName &name)
virtual SbName getName() const
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());
} }
METHODS¶
SoCallback()
Creates a callback node with default settings.
void setCallback(SoCallbackCB *func, void *userData =
NULL)
Sets pointer to callback function and user data. By default, the function
pointer in the node is NULL and does nothing.
static SoType getClassTypeId()
Returns type identifier for this class.
ACTION BEHAVIOR¶
SoGLRenderAction, SoBoundingBoxAction, SoPickAction
Calls the specified callback function for all actions.
FILE FORMAT/DEFAULTS¶
Callback { }
SEE ALSO¶
SoAction, SoCallbackAction, SoEventCallback