Hi,

with the following setup I expect to have a line from the center of the
screeen to the point hard coded. It not that case. Any ideas?

Thanks

this is geode update callback


class UpdateCallback : public osg::NodeCallback
{
public:
UpdateCallback(osgViewer::Viewer* viewer)
 : mViewer(viewer)
{
}

virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
 osg::Geode* geode = dynamic_cast<osg::Geode*>(node);
if (!geode) return;

geode->removeDrawables(0,geode->getNumDrawables());

osg::Geometry* geometry = new osg::Geometry;
 geode->addDrawable(geometry);

osg::Vec3 eye;
osg::Vec3 center;
 osg::Vec3 up;
mViewer->getCamera()->getViewMatrixAsLookAt(eye,center,up);

osg::Vec3Array* verts = new osg::Vec3Array;
verts->push_back(eye);
 verts->push_back(osg::Vec3(20,20,20));
geometry->setVertexArray(verts);

osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0,1,0,1));
 geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);

geometry->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::LINES,0,verts->size()));

float radius = 0.8f;
 float height = 1.0f;

osg::TessellationHints* hints = new osg::TessellationHints;
 hints->setDetailRatio(0.5f);

geode->addDrawable(new osg::ShapeDrawable(new
osg::Sphere(osg::Vec3(20.0f,20.0f,20.0f),radius),hints));

geode->dirtyBound();

}
protected:
 osgViewer::Viewer* mViewer;
};

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to