Hi,

Env: Win7/64bit/MSVC 2008/OSG3.0.1
I make unusual use of OSG - in every iteration I set new parameters,
then I read the results to images and use them (no graphic display is required!)
I have my app keep growing all the time...
Any suggestion?

I'm using the OSG smart pointers (ref_ptr) well - following the doc.
DevPartner Memory analyzer reports any space allocated and assigned to ref_ptr 
as a leak, but I assume it couldn't handle it...
Except that, it doesn't find any leak. I just see the process keeps growing in 
the TaskManager.

Schematically, I do the following (pseudo-code):
(notice all required objects are ref_ptr in my real code)

ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
ref_ptr<osg::Image> colorImage = new osg::Image;
ref_ptr<osg::Image> depthImage = new osg::Image;

viewer->setScheneData(model);

foreach givenViewport
{
  // create 'traits' with some values, inc. target = FRAME_BUFFER_OBJECT
  gc = osg::GraphicsContext::createGraphicsContext(traits.get())
  camera = viewer->getCamera()
  camera->setGraphicsContext(gc)

  // then do some general settings on camera... (I suppress them)
  // then:
  camera->setViewport(..)
  camera->setProjectionMatrixAsPerpective(..)
  camera->setViewMatrixAsLookAt(..)
  if firstTime {veiwer->realize() }

  viewer->frame() 

  // do some calculation using data from colorImage and depthImage...
}

Also I registered a postDrawCallback which is:

operator()(renderinfo)
{
  viewport = renderInfo.getCurrenCamer()->getViewport()
  // I extract from viewport: x, y, height, width
  // The following is the most important part:
  colorImage->readPixels(x,y,width,height, GL_RGBA, 
                      GL_UNSIGNED_BYTE)
  depthImage->readPixels(x,y,width,height, GL_DEPTH_COMPONENT,
                      GL_FLOAT)
}

Do I need to release something after each iteration?

Thank you!  :D 

Cheers,
amir

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=57781#57781





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to