Hi,

I am trying to use a triangle mesh.  And for some reason, it always shows up 
black.  Here is a snipit of code:

  osg::ref_ptr<osg::Geode> _geode;
  _geode = new osg::Geode();

  osg::ref_ptr<osg::TriangleMesh> _trimesh;
  _trimesh = new osg::TriangleMesh();

  osg::ref_ptr<osg::ShapeDrawable> _SD;
  _SD = new osg::ShapeDrawable(_trimesh.get());
  _SD->setColor(osg::Vec4f(1.0f, 1.0f, 1.0f, 1.0f));
  _geode->addDrawable(_SD.get());

  osg::Vec3Array* vecs = new osg::Vec3Array();
  vecs->push_back(osg::Vec3d(0, 0, 0));
  vecs->push_back(osg::Vec3d(1, 0, 0));
  vecs->push_back(osg::Vec3d(0, 0, 1));
  _trimesh->setVertices(vecs);

  osg::TemplateIndexArray<unsigned int, osg::Array::UIntArrayType, 1, 1>* ind =
    new osg::TemplateIndexArray<unsigned int, osg::Array::UIntArrayType, 1, 
1>();
  ind->push_back(0);
  ind->push_back(1);
  ind->push_back(2);
  _trimesh->setIndices(ind);

As you can see, the TriangleMesh is a child of a ShapeDrawable node, which 
should set its color to white.  This technique has worked great for the other 
shape primitives.  Is there another way to set the color for a TriangleMesh?  
Or is there another way I should construct my tree?  Or is it a bug?

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

Reply via email to