Hi,
here is my setup:
Code:
// Get the scene camera (cam1)
osg::ref_ptr<osg::Camera> camera = view->getCamera();
// get the wallpaper camera (cam2)
osg::ref_ptr<osg::Camera> localWallpaperCamera = wallpaperCamera.get();
osg::ref_ptr<osg::Image> image = new osg::Image;
osg::ref_ptr<osg::Image> fbImage = new osg::Image;
fbImage->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE, 1);
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->attach( osg::Camera::COLOR_BUFFER, fbImage.get(), 0, 0);
camera->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
if (hasWallpaper()) {
localWallpaperCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
localWallpaperCamera->attach( osg::Camera::COLOR_BUFFER, fbImage.get(), 0,
0);
localWallpaperCamera->setClearMask( GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT );
camera->setClearMask(GL_DEPTH_BUFFER_BIT );
}
view->frame();
image = fbImage.get();
cam2 is a slave of the view - addSlave(cam2)
This is just a shortened version[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53468#53468
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org