Hi,
On Tue, 2009-06-23 at 17:12 +0200, Andreas Halm wrote:
> Hi Carsten,
>
> > hm, getActNode() gives you the current Node, not the NodeCore. If your
> > render action callback is a member function the current node core is
> > simply "this" and the same as getActNode()->getCore().
> > Can you post the relevant part(s) of your code?
>
> Sorry about that, of course it gives the Node. The problem was occurring
> because I was used to pass the Action* around to methods of other classes,
> and used getActNode()->getCore() there, which no longer works. I changed it
> now to pass the this pointer around instead so I no longer have the code,
> but it was exactly like your cubes sample. If I was not seeing ghosts, it
> should be reproducible using
>
> Action::ResultE Cubes::drawPrimitives(DrawEnv *drawEnv)
> {
> RenderAction* a = drawEnv->getAction();
> Node* node = a->getActNode();
> Cubes* cubes = dynamic_cast<Cubes*>(node->getCore());
>
> At that point, the cubes variable was 0 which confused me, and after
> inspecting the debugger output it seemed like the node was actually the
> DirectionalLight from the headlight.
that is because drawPrimitives is not called during the traversal
but during the drawing so the action state is back to the root of
the tree. If you need information of the traversal state you
have to implement the traversal functions, not the drawing
functions.
But I admit that is not obvious from the drawenv parameter. I'll
see if I refactor things to make it more obvious what actually
is valid and what is not.
kind regards,
gerrit
------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users