|
void AL_Route::update(osg::NodeVisitor *nv, osg:rawable *drawable)
{
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(drawable);
if(!geom)return;
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geom->getVertexArray());
if(vertices)
{
angle =angle+ speed; // float angle; float speed;
vertices->push_back(osg::Vec3(radius*cos(angle),0.0,radius*sin(angle)));
int k=vertices->getNumElements();
geom->addPrimitiveSet(new osg::DrawArrays(osg::DrawArrays:INE_STRIP,0,k));
vertices->dirty();
}
}
这样实现回调正确么?存在越界的可能性大不大?
调试过程中,回调多次会发生错误,在控制台下调试没有错误,集成到MFC框架下出现错误是怎么回事? |
|