Somehow this looks strange and overcomplicated.
I'm even unsure if this is supposed to work at all.
In order to do the RTT thingy you should setup two cameras which render to the texture and the viewer should simply render a fullscreen quad with this texture.

i.e.
ViewerCam
    |
    |-Cam1 (RenderTarget1)
    |   |---your background
    |
    |-Cam2 (RenderTarget1)
    |    |---your Model
    |-FullScreenQuad (with RenderTarget1's texture)
Take a look at osgprerender example.

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

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

Reply via email to