You are correct that it has something to do with BoundingBox. The
BoundingBox around a single point (or two coincident points, in this case)
has zero volume, so either the CullVisitor is discarding it, or the auto
compute of near far is computing two coincident planes and everything is
clipped. Either way, you see nothing.
 
For a solution, grep the source for setInitialBound.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
+1 303 859 9466
 

  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Mojtaba
Fathi
Sent: Thursday, May 28, 2009 4:04 PM
To: OpenSceneGraph Users
Subject: [osg-users] Drawing a point



Hi all
Accept my apology for such a simple question. I want to display two
coincident points at (0,0,0). I use code like this:

int main()
{
    osgViewer::Viewer viewer;

    osg::ref_ptr<osg::Group> root (new osg::Group);
    osg::ref_ptr<osg::Geode> geode (new osg::Geode());
    osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());

    osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());

    vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
    vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));

    geometry->setVertexArray (vertices.get());

    geometry->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::POINTS,0,vertices->size()));

    osg::Point *point=new osg::Point;
    point->setSize(4);
    root->getOrCreateStateSet()->setAttribute(point);

    geode->addDrawable (geometry.get());
    root->addChild(geode.get());
    viewer.setSceneData( root.get() );

    return (viewer.run());
}

But it displays nothing. I think it relates to BoundingBox and culling, so
what should I do to display two coincident points at (0,0,0)? And how to do
it for just one point?

Regards, Moji

        

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

Reply via email to