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

Wojciech Lewandowski w.p.lewandowski at gmail.com
Sat Dec 23 02:45:02 PST 2017


Luckily I was able to quickly locate some code. Its a little different to
what I described earlier because its using 2 cull callbacks (no render
callback) and dummy group to update PreRenderCamera texture sizes but in
general its same approach. I have cleaned it a bit from proprietary stuff.
So rather treat it as an example code blurb. I did not try to compile it.
But in generally this approach worked for me. I think that cull callback
attached to PreRenderGroup can be replaced by some callback in main camera.
But for some reason we could not do it (I do not recall why, maybe main cam
had some other callbacks attached) and  instead just added it in dummy
group.

Cheers,
Wojtek Lewandowsk

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

>
>
> On 23 Dec 2017, at 09:28, Wojciech Lewandowski <w.p.lewandowski at gmail.com>
> wrote:
>
> 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.
>
>
> Thanks, that’s a big help. I was already aware that getting
> ‘_cameraRequiresSetup’ flag set was the critical piece - thst’s actually
> why I was trying detach() + attach() since that *should* set
> _cameraRequiresSetup to true. But your point about getting the correct
> RenderStage makes a lot of sense, and might explain the strange things I
> see indeed.
>
>
> 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.
>
>
> I might do that, but it can wait - thank again for your help.
>
> Kind regards,
> 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/20c96b4a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UpdateFBOCameraSize.cpp
Type: text/x-c++src
Size: 4079 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20171223/20c96b4a/attachment.cpp>


More information about the osg-users mailing list