Hi Sebastian,
try to change the line:
m_camera->setRenderTargetImplementation(osg::Camera::PIXEL_BUFFER_RTT);
into:
m_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
I have never tried osgPPU together with pbuffers. Usualy it shouldn't be any
problem, because osgPPU just do require the texture. However, when UnitOut is
rendered it will render to FBO 0, so the default frame buffer. If your main
camera is then set to use pbuffers, I assume then, that the result of the
osgPPU will be overwritten by your camera. Not sure, just try it.
cheers,
art
seb wrote:
> Hi,
>
> In my application, I just add this code on the init part :
>
>
> Code:
> osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
> texture->setTextureSize(width, height);
> texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
> texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
> texture->setInternalFormat(GL_RGBA);
>
> m_camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
> m_camera->setRenderTargetImplementation(osg::Camera::PIXEL_BUFFER_RTT);
> m_camera->attach(osg::Camera::COLOR_BUFFER, texture);
>
> osg::ref_ptr<osgPPU::Processor> postProcessor = new osgPPU::Processor();
> postProcessor->setCamera(m_camera);
> postProcessor->setName("Processor");
> postProcessor->dirtyUnitSubgraph();
> m_root->addChild(postProcessor.get());
>
> osgPPU::UnitBypass* bypass = new osgPPU::UnitBypass();
> bypass->setName("Bypass");
> postProcessor->addChild(bypass);
>
> osgPPU::UnitInResampleOut* resample = new osgPPU::UnitInResampleOut();
> resample->setName("Resample");
> resample->setInputTextureIndexForViewportReference(-1);
> resample->setFactorX(0.1);
> resample->setFactorY(0.1);
> bypass->addChild(resample);
>
> osgPPU::UnitOut* ppuout = new osgPPU::UnitOut();
> ppuout->setName("PipelineResult");
> ppuout->setInputTextureIndexForViewportReference(-1);
> resample->addChild(ppuout);
>
>
>
> the camera is the only one camera that I have, it is the view's camera.
> the root is the scene data
>
> I just want to do a post render to texture into resampled texture, but I just
> see the scene as there was no ppu (my image is not resampled)
> Do I miss something ?
>
> Cheers,
> Sebastien
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=21152#21152
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org