John Rohlf (jrohlf++at++tubes)
Wed, 20 Oct 93 09:30:16 -0700
We kind of lie when we say the draw is a traversal. What
really happens is that the cull traverses the node hierarchy and flattens
it into a very efficient linear display list which the draw "traverses".
So in the draw process there isn't really a concept of a node
hierarchy. Consequently, draw callbacks are primarily for tweaking
GL.
If you just want to "turn off" a node then you should
do so further upstream, say in the cull or even the app process.
If the boolean is available in the application, then just
call pfNodeTravMask there. Otherwise you can use a cull callback
to prune the traversal:
pfNodeTravFuncs (obj, PFTRAV_CULL, PreCullObjCallback, NULL);
long
PreCullObjCallback (pfTraverser *trav, void *data)
{
if (!obj_on)
return PFTRAV_PRUNE;
else
return PFTRAV_CONT;
}
>Two questions: First, when I replace obj with trav in the callbacks,
>it core dumps. Shouldn't they be the same?
'obj' is a node while 'trav' is a pfTraverser. These are totally different
beasts. Instead of 'obj' you should use pfGetTravNode(trav) which
returns the node that owns the callback.
>Also, do I have to do anything in the post callback?
No. This may be NULL.
>What is the purpose of the return value?
To prune, terminate or continue traversal.
>What happens now is that the boolean flag is initially false and
>even when it changes to true, the object is never drawn.
When multiprocessing the flag may not be visible to all
processes and may always stay false.
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:04 PDT