|
我把createDistortionSubgraph函数中顶点纹理对应的地方(两个for循环),修改为
float fHeight = 2.80955;
float fWidth = 3.74607;
float fSeta=0.767945f;
float fRadius=5.0f;
float px,py,pz; //柱面上的点
float px1,py1,pz1; //截(平)面上的点
osg:rawElementsUShort* elements = new osg::DrawElementsUShort(osg:rimitiveSet::TRIANGLE_STRIP);
int k=0;
for(int i=0;i<noSteps+1;i++)
{
px = fRadius * cos(fSeta / 2 + osg::PI / 2 - i * fSeta / noSteps);
py = fHeight / 2;
pz = -fRadius * sin(fSeta / 2 + osg::PI / 2 - i * fSeta / noSteps);
vertices->push_back(osg::Vec3(px,py,pz));
texcoords->push_back(osg::Vec2(i / noSteps, 1));
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
vertices->push_back(osg::Vec3(px,-py,pz));
texcoords->push_back(osg::Vec2(i / noSteps, 0));
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
elements->push_back(k);
k++;
elements->push_back(k);
k++;
}
polyGeom->addPrimitiveSet(elements);
然后运行,就什么都没有了?哪位高手能给解析一下 ? |
|