|
我用下面代码绘制一个六边形面,但是显示的时候,多了一块三角面片,不知怎么回事?
mVertices->push_back( osg::Vec3(33.0,-23.0,28.0) );
mVertices->push_back( osg::Vec3(10.0,-23.0,28.0) );
mVertices->push_back( osg::Vec3(33.0,-23.0,0.000000) );
mVertices->push_back( osg::Vec3(10.0,-23.0,10.0) );
mVertices->push_back( osg::Vec3(-33.0,-23.0,10.0) );
mVertices->push_back( osg::Vec3(-33.0,2.0,0.000000) );
mVertices->push_back( osg::Vec3(-33.0,-23.0,0.000000) );
mVertices->push_back( osg::Vec3(33.0,2.0,0.000000) );
mVertices->push_back( osg::Vec3(10.0,2.0,10.0) );
mVertices->push_back( osg::Vec3(-33.0,2.0,10.0) );
mVertices->push_back( osg::Vec3(33.0,2.0,28.0) );
mVertices->push_back( osg::Vec3(10.0,2.0,28.0) );
mGeometry->setVertexArray( mVertices );
osg:rawElementsUInt* faceFour =
new osg::DrawElementsUInt(osg:rimitiveSet::POLYGON, 0);
faceFour->push_back(6);
faceFour->push_back(2);
faceFour->push_back(0);
faceFour->push_back(1);
faceFour->push_back(3);
faceFour->push_back(4);
mGeometry->addPrimitiveSet(faceFour);
我本应得到的面样式:
[img]
[/img]
运行上面代码得到的面:
[img]
[/img]
谢谢!
[ 本帖最后由 prh 于 2009-5-1 11:10 编辑 ] |
|