Hi,
I experiment this. I used an already displayed scene in another viewer. (I
think you do not reload your nodes).
So, they are a marker in the osg::Texture which indicates to unref the image
after apply.
I thinks it a save memory trick.
But in our case, the image does not exist anymore when the scene is set to the
second view.
So, I wrote a visitor which look into each node of my graph and check the
stateset.
I apply it just after loading before insert it in my scene.
So, my code:
// osg::StateSet* stateset = ...
osg::StateAttribute* attribute = NULL;
while( (attribute = stateset->getTextureAttribute(i,
osg::StateAttribute::TEXTURE)) )
{
++i;
osg::Texture* tex = dynamic_cast<osg::Texture*>(attribute);
if( tex )
tex->setUnRefImageDataAfterApply( false );
}
And all should work fine.
Eric Z.
________________________________
De : [email protected]
[mailto:[email protected]] De la part de Maxim Gammer
Envoyé : jeudi 29 octobre 2009 12:41
À : OpenSceneGraph Users
Objet : [osg-users] OSG and QT problem
Hello,
There is one problem while using OSGViewer in QT:
first run of Widget goes just fine (1.jpg). After I close it and then create it
again there is an "incorrect" picture (2.jpg).
There is a suspicious chancks in debug info (1.txt and 2.txt):
---- returning cached instanced of ----- tells us that an object wasn't
deleted. I closed widget though.
At the first run there are following strings in debug, but they dissapear at
second run:
------------------
RegisterWindowingSystemInterfa
ceProxy()
X11WindowingSystemInterface()
GraphicsContext::setWindowingSystemInterface() 0x1b26f20 0x7f39a7ccc890
-------------------
The following strings appear at the moment when I delete OSGViewer:
--------------------
Warning: deleting still referenced object 0x6b8d378 of type
'PN3osg10ReferencedE'
the final reference count was 2, memory corruption possible.
--------------------
OSG 2.8.2.
QT 4.5.0
Where to dig for a solution? Thanx in advance.
--
Maxim Gammer
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org