Hi Jody

Add this code:

osg::ref_ptr<osg::Vec4Array> colors (new osg::Vec4Array());
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));

geom->setColorArray (colors.get());
geom->setColorBinding (osg::Geometry::BIND_PER_VERTEX);


Or use shader....


On Wed, Dec 30, 2009 at 6:02 PM, Jody Cole <[email protected]> wrote:

> Hi,
>
> I have created a triangle with, where a,b and c are the (x,y,z) coordinates
> of the 3 vertices
>
> osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
> osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array;
> geom->setVertexArray( v.get() );
> v->push_back(a);
> v->push_back(b);
> v->push_back(c);
> geom->addPrimitiveSet(new osg::DrawArrays( osg::PrimitiveSet::TRIANGLES, 0,
> 3 ) );
> osg::ref_ptr<osg::Geode> geode = new osg::Geode;
> geode->addDrawable( geom.get() );
> root->addChild(geode.get());
>
> Could you tell me how i can color fill the inside of the triangle so it
> will be a green triangle.
>
>
> Thank you!
>
> Cheers,
> Jody
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=21986#21986
>
>
>
>
>
> _______________________________________________
> 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