<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=828452323-27032009><FONT face=Arial
size=2>It looks like your callback is setting a matrix that contains only a
rotate, but doesn't include the scale and translate that you initialize it
with.</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Helvetica size=2>Paul Martz</FONT></DIV>
<DIV align=left><FONT face=Helvetica><STRONG>Skew Matrix Software
LLC</STRONG></FONT></DIV>
<DIV align=left><FONT face=Helvetica size=2><A
href="http://www.skew-matrix.com/">http://www.skew-matrix.com</A></FONT></DIV>
<DIV align=left><FONT face=Helvetica size=2>+1 303 859 9466</FONT></DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> osg-users-bounces@lists.openscenegraph.org
[mailto:osg-users-bounces@lists.openscenegraph.org] <B>On Behalf Of </B>ami
guru<BR><B>Sent:</B> Friday, March 27, 2009 3:50 PM<BR><B>To:</B> OpenSceneGraph
Users<BR><B>Subject:</B> [osg-users] CallBack issue<BR></FONT><BR></DIV>
<DIV></DIV>Hello forum,<BR><BR><BR>I am trying to rorate an object continuously
through a call back. Before calling the calback i am doing some affine
transformation over that object<BR>The final rendered the scaled down to a tiny
object . In the callback subclass i am overloading the () operator and i am
performing the rotation, not any <BR>kind of scaling
down.<BR><BR><BR>**********************code**************************'<BR>class
RotateCB : public osg::NodeCallback<BR>{<BR>public:<BR> RotateCB() :
m_angle(0) { }<BR><BR> virtual void operator()(osg::Node
*node,<BR>
osg::NodeVisitor *nv)<BR> {<BR>
/*<BR> Normally, check to make sure that we have
an update<BR> visitor, not necessary in this
simple example<BR> */<BR><BR>
osg::MatrixTransform * mtLeft =
dynamic_cast<osg::MatrixTransform*>(node);<BR>
osg::Matrix mR;<BR> mR.makeRotate(m_angle,
osg::Vec3(0.0f,0.0f,1.0f));<BR><BR>
mtLeft->setMatrix(mR);<BR><BR> //Increment the angle for
the next from<BR> m_angle +=
0.01;<BR><BR><BR> /*<BR>
Continue traversing so that OSG can process
<BR> any other nodes with
callbacks<BR> */<BR>
traverse(node,nv);<BR>
}<BR><BR><BR>.................................<BR><BR>................................<BR><BR><BR>
osg::ref_ptr<osg::MatrixTransform> teapotPos = new
osg::MatrixTransform;<BR> osg::Matrix teapotTransMat;<BR>
osg::Matrix teapotScaleMat;<BR> osg::Vec3f teapotTransVec =
osg::Vec3f(5,2,-12);<BR> osg::Vec3f teapotScaleVec =
osg::Vec3f(20.1f,20.1f,20.1f);<BR>
teapotTransMat.makeTranslate(teapotTransVec);<BR>
teapotScaleMat.makeScale(teapotScaleVec);<BR><BR>
teapotPos->setMatrix(teapotTransMat * teapotScaleMat);<BR><BR>
//SET THE data variance to dynamic to let OSG know that <BR> //we
shall modify this node during update traversal<BR>
teapotPos->setDataVariance(osg::Object::DYNAMIC);<BR><BR><BR>
//SET THE update callback<BR> teapotPos->setUpdateCallback(new
RotateCB);<BR><BR>................................................<BR><BR><BR>...................................................<BR><BR><BR><BR><BR><BR><BR><BR>*****************************************************'<BR><BR><BR><BR>Any
hint?<BR><BR><BR>Sajjad<BR></BODY></HTML>