Did you accidentally leave display lists on? Paul Martz Skew Matrix Software LLC _http://www.skew-matrix.com_ <http://www.skew-matrix.com/> +1 303 859 9466
Peter Wrobrl wrote:
Hi, I'm trying to set up an Update Callback in osg::Geometry to dynamically change the color of a vertex. I get no error, but my code is not evaluated ( cout in Callback is not printing ). I attached my Callback to osg::Geometry ( a simple Quad ) and setDataVariance( osg::Object::DYNAMIC ) ; //////////////////////////////////////////// // Geometry Update Callback - Not Working // //////////////////////////////////////////// class GeomCallback : public osg::Drawable::UpdateCallback { public : GeomCallback() : _ramp( 0.0f ) {} ; void operator()( osg::Node * node , osg::NodeVisitor * nodeVisitor ) { std::cout << "in Callback !" << std::endl ; osg::Geometry * geom = dynamic_cast< osg::Geometry * >( node ) ; // geometry->getColorArray gives me an osg::Array, but I need a osg::Vec4Array // so I try to cast it, don't know if this works, but get no error osg::Vec4Array * cols = dynamic_cast< osg::Vec4Array * >( geom -> getColorArray() ) ; // As Cols is my Pointer to the Vec4Array I should be able to assign different values cols -> assign( 0 , osg::Vec4f( 0.5f + 0.5f * sin( _ramp ) , 0.0f , 0.0f , 1.0f ) ) ; _ramp += 0.01f ; } private : float _ramp ; } ; Thank you! Cheers, Peter ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20956#20956 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org