下面函数中的代码是原先BOOL CKDtreeDoc::OnNewDocument()函数中的代码,在OnNewDocment中可以实现三维点的显示,而移动下面的函数中时,就显示不了点了!如果下面的函数的代码不动,还要在窗口中显示三维点,需要添加什么语句或方法是怎样的呀?请大家帮忙,谢谢!
void CKDtreeDoc::OnPointsRanom()
{
// TODO: Add your command handler code here/////////////////////////////////////////////
//user add
root = new SoSeparator;
root->ref();SoSeparator * pointmodel = new SoSeparator;//构建浏览器输出点模型SoMaterial *myMaterial;
pointmodel->addChild(myMaterial = new SoMaterial);//设置模型点的材质颜色为红色
myMaterial->diffuseColor.setValue(1.0f,0.0f,0.0f);
SoDrawStyle *ds =new SoDrawStyle;//设置点的大小为3个像素点
ds->pointSize.setValue(3.0f);
pointmodel->addChild(ds);
SoCoordinate3 *pts =new SoCoordinate3;//构建3维坐标OpenInventor对象Getptss1();
pts->point.setValues(0,POINTS_NUM,ptss);//为模型点赋值
pointmodel->addChild(pts);SoPointSet* PointSet = new SoPointSet();//设置点的输出序列
pointmodel->addChild(PointSet);root->addChild(pointmodel);//在浏览器中显示点模型////////////////////////////////////////////////////////////
}

解决方案 »

  1.   

    原来的代码就是上面贴出来的代码,原先是在CKDtreeDoc::OnNewDocument()中,现在我把他放在上述的那个函数中,编译通过了,但三维点不绘制了,视窗是空白的!
      

  2.   

    上述代码中Getptss1()函数,可以为数组pstt赋值,然后在导入到浏览器中!
    你说的绘制函数,是说浏览器如何嵌入到视图中的吧 ,我用的是OpenInventor的浏览器,他的嵌入是在视图中,
    绘制点模型的函数就是上述代码啊帮帮我呀 哎 两三天都过去了