Hi everyone,

I'm wondering about a strange thing I noticed when trying to use
osgUtil::pushModelViewMatrix() directly:

- Suppose I have a class where I store a ref pointer on a RefMatrix:

 osg::ref_ptr<osg::RefMatrix> _modelView.

- Suppose in that class I have a function called during the cull traversal:

draw(osgUtil::CullVisitor& cv) {

   osg::Matrixd mat = .... // I compute the matrix I want to use as model
view here.

#if STRANGE_BEHAVIOR
  _modelView->set(mat)
  cv.pushModelViewMatrix( _modelView.get(), osg::Transform::RELATIVE_RF)
#else
  cv.pushModelViewMatrix(new osg::RefMatrix(mat),
osg::Transform::RELATIVE_RF)
#endif

   // drawing something here with a member geode object:
  _geode->accept(cv);
  cv.popModelViewMatrix();

}

=> If I try the "STRANGE_BEHAVIOR" section, I get nothing displayed
properly (even it the OSG Stats report a good number of vertices). If I use
the other section everythig is fine...

Any idea what I'm missing here ?? I think it would be better if I could
avoid creating a new object on the heap for each call to this function :-)

cheers,
Manu.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to