Hi Werner,

Instead of modifying the main camera attachments, you might want to create a 
slave camera whose sole purpose is to render to FBO. Then you can 
enable/disable that camera using slaveCamera->setNodeMask (0x0 to disable, 
0xffffffff) to enable.


Code:

// Create slave camera and set its attachment
osg::Camera *slaveCamera = new osg::Camera;
slaveCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
/** Create & attach your image here */

// Add slave camera to view and set its projection offset matrix
view->addSlave(slaveCamera, true) // true = use master camera's scene
osg::View::Slave *theSlave = view->findSlaveForCamera(slaveCamera);
theSlave->_projectionOffset = offsetMatrix;

// Enable slave when you want to render to FBO
slaveCamera->setNodeMask(0xffffffff);

// Disable camera on the next frame
slaveCamera->setNodeMask(0x0);

// Profit




Hope this helps,
Ravi

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





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

Reply via email to