Hi,
a simple line drawing code is below but i'm sure you want more complicated 
solition. Below you can update the start and end points on the fly by osgGA 
mouse movement.

Code:

osg::Vec3 sp(0,-180,120);
osg::Vec3 ep(0,480,120);
osg::ref_ptr<Geometry> beam( new osg::Geometry);
osg::ref_ptr<osg::Vec3Array> points = new osg::Vec3Array;
points->push_back(sp);
points->push_back(ep);
osg::ref_ptr<osg::Vec4Array> color = new osg::Vec4Array;
color->push_back(osg::Vec4(1.0,0.0,0.0,1.0));
beam->setVertexArray(points.get());
beam->setColorArray(color.get());
beam->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE);
beam->addPrimitiveSet(new osg::DrawArrays(GL_LINES,0,2));




Thank you!

Cheers,
Tolga

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44430#44430





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

Reply via email to