|
我相对天空盒就行更换纹理,这是我写的回调程序,怎么一直有错误啊?
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osg::ref_ptr<osg::Geode> st=dynamic_cast<osg::Geode*>(node);
if(st)
{
osg::StateSet *ss = st->getOrCreateStateSet();
osg::TextureCubeMap* skymap = dynamic_cast<osg::TextureCubeMap*>(ss->getAttribute(osg::StateAttribute::TEXTURE));
if (panoramaInputDeviceState->moveUpRequest)
{
osg::Image* imagePosX1 = osgDB::readImageFile("ladybug_cube_000001_3.jpg");
osg::Image* imageNegX1 = osgDB::readImageFile("ladybug_cube_000001_1.jpg");
osg::Image* imagePosY1 = osgDB::readImageFile("ladybug_cube_000001_5.jpg");
osg::Image* imageNegY1 = osgDB::readImageFile("ladybug_cube_000001_4.jpg");
osg::Image* imagePosZ1 = osgDB::readImageFile("ladybug_cube_000001_2.jpg");
osg::Image* imageNegZ1 = osgDB::readImageFile("ladybug_cube_000001_0.jpg");
if (imagePosX1 && imageNegX1 && imagePosY1 && imageNegY1 && imagePosZ1 && imageNegZ1)
{
skymap->setImage(osg::TextureCubeMap:OSITIVE_X, imagePosX1);imagePosX1->dirty();
skymap->setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX1);imageNegX1->dirty();
skymap->setImage(osg::TextureCubeMap:OSITIVE_Y, imagePosY1);imagePosY1->dirty();
skymap->setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY1);imageNegY1->dirty();
skymap->setImage(osg::TextureCubeMap:OSITIVE_Z, imagePosZ1);imagePosX1->dirty();
skymap->setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ1);imageNegZ1->dirty();
}
}
}
traverse(node, nv);
}
这个是我写的operator函数,但是执行到skymap->setImage(osg::TextureCubeMap:OSITIVE_X, imagePosX1);imagePosX1->dirty();
就会出现调用栈错误,还出现
这个错误提示,到底怎么回事啊? |
|