Hi Robert,
Yes, the program was first rendering, then dumping, the scene-graph.
Neither pager->setUnrefImageDataAfterApplyPolicy()
nor export OSG_OPTIMIZER=OFF helped.
My program has procedurally-generated textures that are large,
so OSG freeing them makes sense.
The solution I found is to:
1. The app has to write procedural textures to files (.png),
so that they'll be referenced in the dumped .osg file.
image->setFileName( textureName );
osgDB::writeImageFile( *image, textureName );
2. Dump the scene-graph BEFORE rendering it.
If rendered first, textures will be lost regardless (why?).
This is why (the texture : file association is lost):
Texture2D {
name "terrain_texture"
< file "terrain_texture.png"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[line will be omitted if rendered prior]
> Are loading the scene, rendering and then writing out the scene graph?
>
> If so then it's likely that your scene graph as the Texture
> UnrefImageAfterApply enabled on them so that once the image data is
> downloaded to OpenGL the images get discarded so there's no handle to
> write them out to disk any more.
>
> By default this feature is off, but the osgUtil::Optimizer in it's
> default settings will enable it, so if you run the Optimzer this is
> probably the culprit. The DatabasePager also set up to enable this
> feature to help keep memory usage down.
>
> Robert.
>
> On Thu, Jan 14, 2010 at 3:46 PM, Jim Brooks wrote:
> > I'm trying to "dump" the scene-graph.
> >
> > osgDB::writeNodeFile() writes geometry/colors ok,
> > but (OSG 2.9.6) omits texture objects.
> >
> > Eg, when running osgviewer on the dumped .osg file,
> > textures don't appear.
> >
> > Is this behavior of writeNodeFile() intentional?
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org