Hi Danny,

I'm using OSG inside of ActiveX control (based on OSGActiveX example) embedded into HTML 
page. First time when I'm loading it and each time I'm taking snapshot, I'm getting 
"test_0.png" and each snapshot overwrites this file.
When I'm pressing F5 or reloading page using IE address bar I'm starting to 
save snapshots as test_1.png and each snaphot overwrite this file.
This behavior continues each time I'm reloading page. the counter is being 
incremented by one to test_2, test_3 etc....
the only solution for this problem is to close IE and to wait till ActiveX 
unloads from Memeory. after it the counts start form zero.

Check the code for osgViewer::ScreenCaptureHandler::WriteToFile in src/osgViewer/ScreenCaptureHandler.cpp. There must be a bug there. It's pretty simple code, so you can make your own version of WriteToFile that does whatever you want, and then use an instance of your class in the constructor of ScreenCaptureHandler.

// pseudocode
class MyWriteToFile
  : public osgViewer::ScreenCaptureHandler::WriteToFile
{
  MyWriteToFile(filename, extension, savePolicy)
    : osgViewer::ScreenCaptureHandler::WriteToFile(filename, extension,
                                                   savePolicy)
  {
    // ...
  }

  operator()(...)
  {
    // ...
  }

  // ...
};

// then...
osgViewer::ScreenCaptureHandler* _scnsvr;
_scnsvr = new osgViewer::ScreenCaptureHandler(new MyWriteToFile("test","png",osgViewer::ScreenCaptureHandler::WriteToFile::SavePolicy::OVERWRITE));

(if you do find a bug in the existing code please let us know so we can fix it for future versions of OSG though)

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to