Hi, what's wrong in the following code?
Code: osg::Geometry* createPyramid(const osg::Matrixd& iTransform, const osg::Vec4& iColor) { osg::Geometry* geom = new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array(5+2); (*vertices)[0].set(iTransform.preMult(osg::Vec3d(8.0f, 0.0f, 0.0f))); (*vertices)[1].set(iTransform.preMult(osg::Vec3d(0.0f, 8.0f, 0.0f))); (*vertices)[2].set(iTransform.preMult(osg::Vec3d(-8.0f, 0.0f, 0.0f))); (*vertices)[3].set(iTransform.preMult(osg::Vec3d(0.0f, -8.0f, 0.0f))); (*vertices)[4].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f))); (*vertices)[5].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f))); //4line (*vertices)[6].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, -50.0f))); //4line osg::UByteArray* indices = new osg::UByteArray(18); (*indices)[0]=0; (*indices)[1]=1; (*indices)[2]=4; (*indices)[3]=1; (*indices)[4]=2; (*indices)[5]=4; (*indices)[6]=2; (*indices)[7]=3; (*indices)[8]=4; (*indices)[9]=3; (*indices)[10]=0; (*indices)[11]=4; (*indices)[12]=1; (*indices)[13]=0; (*indices)[14]=3; (*indices)[15]=2; (*indices)[16]=1; (*indices)[17]=3; geom->setVertexArray(vertices); geom->setVertexIndices(indices); osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(iColor); geom->setColorArray(colors); geom->setColorBinding(osg::Geometry::BIND_OVERALL); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, indices->size())); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 5, 2)); //4line return geom; } I added the three "//4line" lines of code to explain my problem. In this case I would add a line starting from the top of the pyramid downwards but I just see the pyramid instead. Regards Gianni ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29322#29322 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org