SOLUTION

For anyone who struggled with this here is my solution.
I really have no idea how "correct" it is but it works for me


Code:
  //Setup of the viewer and scenedata here

   osg::ref_ptr<osg::Camera>  osgCam = viewer.getCamera(); 

   osg::ref_ptr<osg::Image>   colorImage= new osg::Image; 
   osg::ref_ptr<osg::Image>   zImage = new osg::Image; 

   colorImage->allocateImage(1024, 768, 1, GL_RGBA, GL_UNSIGNED_BYTE); 
   zImage->allocateImage(1024, 768, 1, GL_DEPTH_COMPONENT , GL_UNSIGNED_BYTE); 

   osgCam->attach(osg::Camera::COLOR_BUFFER, colorImage.get()); 
   osgCam->attach(osg::Camera::DEPTH_BUFFER, zImage.get()); /* */ 

   viewer.frame();  

   Sleep(100);
   osgDB::writeImageFile(*colorImage.get(),"color.bmp"); 
   osgDB::writeImageFile(*zImage.get(),"depth.bmp"); 





Cheers,
aaron

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





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

Reply via email to