Re: [osg-users] Turning off main osgViewer camera
Hi, Thanks for the replies. Brian: when I set the nodemask on the main camera to zero it no longer renders, which is good, but the FBO no longer gets rendered (I get a totally black image in the associated osg::Image). JP: If I just insert my FBO into the scene (as POST_RENDER) two things happen when I render a frame: I get the correct image in my FBO, but the main camera also renders. I want to be able to choose if the the main camera should render or not when the FBO is in use. I looked at osgautocapture, but it doesn't do what I need to do because the main camera always renders (and has to as the saved image comes from a DrawCallback on the main camera). I've also tried simply putting my fbo directly into the viewer with: savedcam=osgviewer->getCamera() osgviewer->setCamera(myfbo) osgviewer->renderingTraversals() osgviewer->setCamera(savedcam) But when I do this not only do I not get an image in my FBO, but the viewer (with the normal camera) no longer renders afterwards. I suspect a workable solution would be to create a duplicate Viewer, setup with only an FBO as the main camera, and which shares the scene (and database pager, etc) with the first Viewer. Then when I need to save screenshot(s) I can just explicitly render with the second Viewer. But surely such a drastic solution shouldn't be necessary? Thank you! Cheers, jake -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16120#16120 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Turning off main osgViewer camera
Hi, I have an application where I setup a "normal" osgViewer view with setUpViewOnSingleScreen(). This works fine. I also create an FBO camera to which I add my scene. When I want to take a screenshot of the application I call osgviewer->setSceneData(myFBOCamera) and render via osgviewer->eventTraversal() / updateTraversal() / renderingTraversals(). After I get the screenshot I restore my normal scene with osgviewer->setSceneData(mySceneData). This also works fine for taking screenshots. What I want to do now is to turn off the "main" camera whilst I render the FBO (ie if I create a lot of screenshots for a movie I don't want to render to the screen). How can I turn off the main camera and render only to the FBO? I've tried calling osgviewer->setCamera(NULL) without sucess. Indeed when I meddle with the main camera I dont get a valid image from my FBO. I think this makes sense as the FBO is under the main camera(?). I also tried calling osgviewer->setCamera(myFBO) but no luck that way either. I also can't restore the original camera to the osgviewer. Perhaps I am solving the problem the wrong way - is there a better method? Perhaps having two seperate osgViewer objects? But then I think I have only one conceptual "View" (my FBO always shows the same view as the main camera, it's only a question of if the main camera should render an image or not), so having one Viewer, one View and two Cameras feels correct - it's just that it doesn't work :-) Thank you! Cheers, jake -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16079#16079 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org