I'm trying to insert untextured, hand-drawn vector shapes into a
pre-existing osg environment.

I had tried the following (cut & paste from one of the examples) and
modifications to it without any good effect. The code compiles, but
when run, no shape appears.

Could someone help me?

Regards,

-James

 osg::Geode* geode = new osg::Geode();
  osg::ConvexHull* mesh = new osg::ConvexHull;
  osg::Vec3Array* vertices = new osg::Vec3Array(4);
  (*vertices)[0].set(9.0+0.0f,-1.0f+2.0f,-1.0f+0.0f);
  (*vertices)[1].set(9.0+1.0f,-1.0f+0.0f,-1.0f+0.0f);
  (*vertices)[2].set(9.0+2.0f,-1.0f+2.0f,-1.0f+0.0f);
  (*vertices)[3].set(9.0+1.0f,-1.0f+1.0f,-1.0f+2.0f);
  osg::UByteArray* indices = new osg::UByteArray(12);
  (*indices)[0]=0;
  (*indices)[1]=2;
  (*indices)[2]=1;
  (*indices)[3]=0;
  (*indices)[4]=1;
  (*indices)[5]=3;
  (*indices)[6]=1;
  (*indices)[7]=2;
  (*indices)[8]=3;
  (*indices)[9]=2;
  (*indices)[10]=0;
  (*indices)[11]=3;
  mesh->setVertices(vertices);
  mesh->setIndices(indices);
  geode->addDrawable(new osg::ShapeDrawable(mesh));
 viewer.setSceneData( (osg::Node*) geode );
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to