Debian Codegraph @

doc/man/man3/ivm/nodes/SoCallback.ivm

raw
1 NAME SoCallback SoCB "" { provides custom behavior during actions }
2
3 INCLUDE nodes/SoCallback.h
4
5 DESC {
6 This node provides a general mechanism for inserting callback functions
7 into a scene graph. The callback function registered with the node is
8 called each time the node is traversed while performing any scene graph
9 action. The callback function is passed a pointer to the action being
10 performed and a user data pointer registered with the callback function.
11 You can use this node to make nonstandard OpenGL calls while rendering. If
12 you do, be careful not to interfere with Inventor's use of OpenGL.
13 \p
14 If you use a callback node for GL rendering, you should be careful
15 to follow render caching rules. If your callback node can make
16 different rendering calls each time it is traversed, it cannot be
17 cached. In such a case, the node should invalidate any open caches,
18 as in the following example:
19 \p\k\b
20 void
21 myCallbackFunc(void *d, SoAction *action) \{
22 if (action->isOfType(SoGLRenderAction::getClassTypeId())) \{
23 // Make my custom GL calls
24 ((MyClass *) d)->myRender();
25
26 // Invalidate the state so that a cache is not made
27 SoCacheElement::invalidate(action->getState());
28 \}
29 \}\.\.
30 }
31
32 TYPEDEF void SoCallbackCB "(void *userData, SoAction *action)"
33
34 METHOD "" SoCallback() {
35 Creates a callback node with default settings.
36 }
37
38 METHOD setCB void setCallback(SoCallbackCB *func, void *userData = NULL) {
39 Sets pointer to callback function and user data. By default, the
40 function pointer in the node is NULL and does nothing.
41 }
42
43 METHOD "" static SoType getClassTypeId() {
44 Returns type identifier for this class.
45 }
46
47 ACTION SoGLRenderAction, SoBoundingBoxAction, SoPickAction {
48 Calls the specified callback function for all actions.
49 }
50
51 ALSO { SoAction, SoCallbackAction, SoEventCallback }
52