Improove texture sharing.
This commit is contained in:
@@ -136,6 +136,9 @@ public:
|
|||||||
if (!texture)
|
if (!texture)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Hmm, true??
|
||||||
|
texture->setDataVariance(osg::Object::STATIC);
|
||||||
|
|
||||||
osg::Image* image = texture->getImage(0);
|
osg::Image* image = texture->getImage(0);
|
||||||
if (!image)
|
if (!image)
|
||||||
return;
|
return;
|
||||||
@@ -379,6 +382,7 @@ SGLoadTexture2D(const std::string& path, bool wrapu, bool wrapv, int)
|
|||||||
osg::Image* image = osgDB::readImageFile(path);
|
osg::Image* image = osgDB::readImageFile(path);
|
||||||
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
|
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
|
||||||
texture->setImage(image);
|
texture->setImage(image);
|
||||||
|
texture->setDataVariance(osg::Object::STATIC);
|
||||||
if (wrapu)
|
if (wrapu)
|
||||||
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||||
else
|
else
|
||||||
@@ -408,7 +412,7 @@ SGLoadTexture2D(const std::string& path, bool wrapu, bool wrapv, int)
|
|||||||
|
|
||||||
// OSGFIXME: don't forget that mutex here
|
// OSGFIXME: don't forget that mutex here
|
||||||
osgDB::Registry* registry = osgDB::Registry::instance();
|
osgDB::Registry* registry = osgDB::Registry::instance();
|
||||||
registry->getOrCreateSharedStateManager()->share(tmpNode.get(), 0);
|
registry->getSharedStateManager()->share(tmpNode.get(), 0);
|
||||||
|
|
||||||
// should be the same, but be paranoid ...
|
// should be the same, but be paranoid ...
|
||||||
stateSet = tmpNode->getStateSet();
|
stateSet = tmpNode->getStateSet();
|
||||||
|
|||||||
Reference in New Issue
Block a user