Thanks Robert, Its been great Help! Just setting setUnRefImageDataAfterApply to FALSE did the job.

Pawan

On Wed, 22 Nov 2006, Robert Osfield wrote:

Hi Pawan,

The cow.ive file you have will have textures in it that have the
Texture::setUnRefImageDataAfterApply set to true, so that as soon as
the scene's GL objects are download to OpenGL the source image is
released.

This features helps minimize memory usage at runtime, but... it also
means that the later saving of the model doesn't have the image from
which to get the info about the source file.

By default osg::Texture::setUnRefImageDataAfterApply is false, but the
osgUtil::Optimizer has a pass in it that sets it to true.  You can
control the optimizer options via a bit mask of via the OSG_OPTIMIZER
env var.  Do a osgviewer --help-env to get the details.

Robert.

On 11/22/06, Pawan Harish <[EMAIL PROTECTED]> wrote:
Hi,
   I am trying to load a textured file into a simple osg viewer. Before
exiting I am writing the rootnode to another file. Somehow the texture in
the original loaded file is not written. The problem is with
viewer.realize() function. How can I get the texture even after this
function is called. The code I am using is:

osg::Node *rootnode = osgDB::readNodeFile("cow.ive");
viewer.setSceneData(rootnode);
viewer.realize(); //This is the culprit. Removes texture from model
while( !viewer.done() )
    {
     viewer.sync();
     viewer.update();
     viewer.frame();
     }

//No texture in this file, don't know why...
osgDB::writeNodeFile(*rootnode,"output.osg");

Pawan Harish

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to