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());
}
}