Re: [osg-users] Loose texture in ive after display the node

2008-11-07 Thread Lionel Lagarde




Hi, 

the texture used in your model has the unRefImageDataAfterApply flag
set. The apply occurs
in the first frame. You can turn off this flag in the Texture attribute.

Eric ZAREMBA wrote:

  
  
  
  
  Hi,
  
  I have a
strange problem during .IVE saving.
  As you can
see in the following, I just open an .IVE
file, display it and save it.
  After this
tree operation, the new .IVE file has
loosing his texture
  I have the
problem with the file join to the email
(and a lot of others).
  But I have
some other .IVE files which work correctly
without any problem
  I suppose
that the error comes from the .IVE file structure?
Can you help me?
  
  During my
test, I had a file which was saved
properly. But, if it was included via a ProxyNode, it was embedded into
the
root ive and lost its textures.
  
  Context:
  Windows XP
SP3
  NVidia
7600GT or ATI FireGL 5100V
  OSG 2.6
  Visual
Studio 2005 SP1
  Qt 4.3 even
if it is not used in the example below.
  
  #include osgViewer/Viewer
  #include osgDB/ReadFile
  #include osgDB/WriteFile
  #include osgGA/TrackballManipulator
  
  int
main(int
argc, char
*argv[])
  {
  
osg::ArgumentParser
args( argc, argv );
  
osgViewer::Viewer
viewer( args );
  
viewer.realize();
  
  
osg::ref_ptrosg::Node
pNode = osgDB::readNodeFile( "Data/BufferStop.ive"
);
  
  if(
!pNode )
  
osg::notify(
osg::ALWAYS )  "Cannot
read the file\n";
  
  
  viewer.setSceneData(
pNode.get() );
   viewer.setCameraManipulator(
  new
osgGA::TrackballManipulator );
  
  
  // If we write the
node before show it,
the result is Ok.
  
  if(
!osgDB::writeNodeFile(
*pNode, "../HopBefore.ive"
) )
  
{
  
osg::notify(
osg::ALWAYS )  "Failed\n";
  
  return 1;
  
}
  
  
  while(
!viewer.done() )
  
viewer.frame();
  
  
  // Since we displayed
the node, we loose
the texture at saving.
  
  if(
!osgDB::writeNodeFile(
*pNode, "../HopAfter.ive"
) )
  
{
  
osg::notify(
osg::ALWAYS )  "Failed\n";
  
  return 1;
   }
  
   return 0;
  }
  
  Best
regards,
  Eric Z.
  
  
  
  

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Loose texture in ive after display the node

2008-11-07 Thread Robert Osfield
Hi Linoel,

If you use unRefImageDataAfterApply then the image is discarded as
soon as the image data to download to OpenGL, which helps reduce
memory consumption significantly so is great for real-time sims.
However, if you discard the image data then you can't later use to it
write out to disk.   If you want to write out data you can't use this
feature.

Robert.

On Fri, Nov 7, 2008 at 8:49 AM, Lionel Lagarde [EMAIL PROTECTED] wrote:
 Hi,

 the texture used in your model has the unRefImageDataAfterApply flag set.
 The apply occurs
 in the first frame. You can turn off this flag in the Texture attribute.

 Eric ZAREMBA wrote:

 Hi,



 I have a strange problem during .IVE saving.

 As you can see in the following, I just open an .IVE file, display it and
 save it.

 After this tree operation, the new .IVE file has loosing his texture…

 I have the problem with the file join to the email (and a lot of others…).

 But I have some other .IVE files which work correctly without any problem…

 I suppose that the error comes from the .IVE file structure? Can you help
 me?



 During my test, I had a file which was saved properly. But, if it was
 included via a ProxyNode, it was embedded into the root ive and lost its
 textures.



 Context:

 Windows XP SP3

 NVidia 7600GT or ATI FireGL 5100V

 OSG 2.6

 Visual Studio 2005 SP1

 Qt 4.3 even if it is not used in the example below.



 #include osgViewer/Viewer

 #include osgDB/ReadFile

 #include osgDB/WriteFile

 #include osgGA/TrackballManipulator



 int main(int argc, char *argv[])

 {

   osg::ArgumentParser args( argc, argv );

   osgViewer::Viewer viewer( args );

   viewer.realize();



   osg::ref_ptrosg::Node pNode = osgDB::readNodeFile(
 Data/BufferStop.ive );

   if( !pNode )

 osg::notify( osg::ALWAYS )  Cannot read the file\n;



   viewer.setSceneData( pNode.get() );

   viewer.setCameraManipulator( new osgGA::TrackballManipulator );



   // If we write the node before show it, the result is Ok.

   if( !osgDB::writeNodeFile( *pNode, ../HopBefore.ive ) )

   {

 osg::notify( osg::ALWAYS )  Failed\n;

 return 1;

   }



   while( !viewer.done() )

 viewer.frame();



   // Since we displayed the node, we loose the texture at saving.

   if( !osgDB::writeNodeFile( *pNode, ../HopAfter.ive ) )

   {

 osg::notify( osg::ALWAYS )  Failed\n;

 return 1;

   }



   return 0;

 }



 Best regards,

 Eric Z.





 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org