Hi Torben,

You said, the view matrix based on the camera manipulator is calculated during the 
cull traversal, so the viewmatrix I send during the  camera->eventCallback is 
the viewmatrix of the last frame.

No, I said the viewer gets the view matrix from the manipulator during the cull traversal. See the slight difference?

The manipulator's view matrix is calculated any time someone calls its getMatrix() or getInverseMatrix() method, and it's calculated from the data it has at that precise moment. The viewer happens to call this method during the cull traversal. But you could call it during the event traversal.

You just need to make sure the camera manipulator has all the data it needs to calculate the right view matrix for the current frame when you call its getMatrix() or getInverseMatrix() method. i.e. you want it to have the same information as it will have later during the cull traversal, so that the result you get is the same as the result the viewer will get when it calls the same method.

Depending on your manipulator the information it needs will be different. It processes events during the event traversal, and if it's a node tracker manipulator it depends on the position of the node it's tracking being updated too, which might happen in the update traversal (only you know your whole app so you should know).

Again, placing breakpoints will tell you what's going on. Place one breakpoint where you call manipulator->getMatrix() or getInverseMatrix(), one breakpoint in the manipulator's handle() method (which is called in the event traversal), and another where the viewer calls getInveseMatrix() on it. Depending on when each of these breakpoints hits (i.e. 1 then 2 then 3, or 2 then 1 then 3, etc.) you'll know what state each one is getting. If everything is updated, and then you call getInverseMatrix() and the viewer calls it right after, you know both got the same information so you're getting the view matrix for the right frame.

Hope this clears things up,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to