Here is how I prepare the camera(s) for PPU:

/** Setup the camera to do the render to texture */
void Cl_3Dview_osg::setupCameraForPipeline() {
    // setup viewer's default camera
    osg::Camera* camera = view->getCamera();
    osg::Viewport* vp = camera->getViewport();

    // create texture to render to
    osg::Texture* texture = createRenderTexture(
                                             (int)vp->width(), 
(int)vp->height(), false);
    osg::Texture* depthTexture = createRenderTexture(
                                             (int)vp->width(), 
(int)vp->height(), true);

    // tell the camera to use OpenGL frame buffer object where supported.
    camera->setRenderTargetImplementation(
                                             osg::Camera::FRAME_BUFFER_OBJECT);
    // attach the texture and use it as the color buffer.
    camera->attach(osg::Camera::COLOR_BUFFER, texture);
    camera->attach(osg::Camera::DEPTH_BUFFER, depthTexture);
//    if (wallpaperCamera.valid()) {
//        wallpaperCamera->setRenderTargetImplementation(
//                                           osg::Camera::FRAME_BUFFER);
//        wallpaperCamera->attach(
//                                           osg::Camera::COLOR_BUFFER, 
texture);
//    }
}

Commenting in our out of the last part does not do any difference. But why?

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





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

Reply via email to