[osg-users] Resizing an FBO camera with OSG 3.2.0

Wojciech Lewandowski w.p.lewandowski at gmail.com
Sat Dec 23 01:28:52 PST 2017


Hi, James,

Unfortunately I could not dig out the code I had to solve this problem. But
I did fight with it on couple occasions. I do remember that often the
solution I adopted had to use 2 callbacks (cull/update callback +
prerender/render/or postrender callbace). One update/cull callback was
needed to resize textures (they were tied to main window resolution) and
second callback to invoke FBO update setup for new sizes. Somehow it was
impossible to do that in one shot (probably because I could not access
proper RenderStage in cull/update callback). That second callback had to be
a camera PreRender or (some earlier render order camera PostRender or some
other earlier render order drawable DrawCalback). Role of that second
callback was to obtain proper RenderStage for FBO camera and set its
_cameraRequiresSetup flag.   Once _cameraRequiresSetup flag was set to
true, next rendering traversal was doing the rest. Really setting
RenderStage::_cameraRequiresSetup was the crucial ingredient to solve that
problem back then.

Hope this helps,
Wojtek

PS. If you are still fighting with it, but may wait till January, send me a
private email and I will dig out the code. Unfortunately I cannot do it
right away (I am swamped in December) but may be have more time to scan
through my backups and find it in January.




2017-12-23 9:09 GMT+01:00 James Turner <zakalawe at mac.com>:

>
>
> > On 18 Dec 2017, at 11:51, Robert Osfield <robert.osfield at gmail.com>
> wrote:
> >
> >    if (modified)
> >    {
> >        dirtyAttachmentMap();
> >    }
>
> Thanks Robert,
>
> Unfortunately this line is the part that I can’t figure out how to
> replicate in OSG-3.2 - resizing the textures is easy enough and I’ve
> already been doing that, but the attachment-map-dirty mechanism seems to go
> deeper into the render pass system.
>
> I did try actually removing and re-adding the attachments to the Camera,
> to trigger the same work as when the attachments are initially made. That
> compiles but doesn’t make any difference alas.
>
> (Something like….)
>
>         camera->detach(osg::Camera::COLOR_BUFFER);
>         camera ->attach(osg::Camera::COLOR_BUFFER, _fboTexture);
>
> Oh well, thanks for the suggestion anyway.
>
> James
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20171223/d8cb1ad0/attachment.html>


More information about the osg-users mailing list