On Wed, 2011-06-15 at 19:06 +0200, basil huffman wrote:
> I am looking to figure out how to give thickness to line segments. I am 
> creating them as follows
> 
> Code:
> 
>         osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
>         osg::ref_ptr<osg::DrawArrays> drawArrayLines = new  
> osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP);
>       
>       osg::ref_ptr<osg::Vec3Array> vertexData = new osg::Vec3Array;
> 
>       geom->addPrimitiveSet(drawArrayLines);
>       geom->setVertexArray(vertexData);
>        
>        //loop through points
>        vertexData->push_back(osg::Vec3d(point.X,point.Y,point.Z));
>        //
>        drawArrayLines->setFirst(0);
>       drawArrayLines->setCount(vertexData->size());   
>       
>       // Add the Geometry (Drawable) to a Geode and return the Geode.
>       osg::ref_ptr<osg::Geode> geode = new osg::Geode;
>       geode->addDrawable( geom.get() );
>        
> 
> 
> 
> How can I give these line segments thickness and color?  Also, is this the 
> best way to plot line segments?

You want to use <osg/LineWidth> for this if you're using the FFP. It's
quite easy to use:

        osg::LineWidth* lineWidth = new osg::LineWidth();

        lineWidth->setWidth(2.0f);

        ...getOrCreateStateSet()->setAttributeAndModes(lineWidth,
osg::StateAttribute::ON);

If you're using a programmable pipeline, I'm not entirely sure this
works. Haven't tested it (yet).

> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=40542#40542
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 


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

Reply via email to