Hi thanks fot the advice, it worked.
Here is how I implemented getting the modeview matrix for a specific node.
I include it for future reference for users searching this list.

class CullCallback : public osg::NodeCallback
{
        virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
        { 
            osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
        
            if (cv)
            {
                std::cout<<"CULLVISITOR callback - 
ModelviewMatrix"<<node<<std::endl;
                osg::Matrix mat = *(cv->getModelViewMatrix());
                for (int i = 0; i < 4; i++)
                {
                    printf ("\t");
                    for (int j = 0; j < 4; j++)
                         printf ("%8.3f ", mat (i, j));
                    printf ("\n");
                }
            }

            traverse(node,nv);
        }
};


Then in the creation of the scenegraph you attach the Callback to the desired 
node

node->setCullCallback (new CullCallback);


Dimi




----- Original Message ----
From: Robert Osfield <[email protected]>
To: OpenSceneGraph Users <[email protected]>
Sent: Wednesday, May 20, 2009 11:20:33 AM
Subject: Re: [osg-users] Extracting modelview matrix from main loop

On Wed, May 20, 2009 at 9:07 AM, dimi christop <[email protected]> wrote:
> thanks for the reply.
> I have implemented all sorts of particle functionality (tris, lines, quads) 
> already therefore
> I prefer to port the code (if possible) initially as is  and enhence it 
> further after that.
> Any idea how to get the modelview matrix?

>From the CullVisitor you just do cullvistor->getModelViewMatrix()
which passes back a pointer to a RefMatrix (which is just a Matrix
with reference counting.)

You can get the CullVisitor by dynmaically casting the NodeVistor
passed in to the Node::traverse() method or the node callback.   Have
a search through OSG sources to see example of this being done.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



      
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to