[osg-users] Shaders with multiple views using ViewportCallback

Robert Osfield robert.osfield at gmail.com
Wed May 9 04:23:27 PDT 2018

Hi Chritoph,

The right way to do is to to assign an osg::Uniform to each
osg::View's master Camera's StateSet i,e

osg::Uniform("viewport", osg:::Vec4(x,y,w,h));


On 9 May 2018 at 10:20, Christoph Dohmen <christoph.dohmen at cae.de> wrote:
> Hi all,
> I need to use the viewport dimensions for some calculations in my vertex shader. The most found way of doing the update of the viewport-size uniform is the ViewportCallback derived from osg::Uniform::Callback which encapsulates a camera.
> But what happens if I have multiple views?
> How can I fetch the viewport size in my shader per viewer?
> Thank you!
> Cheers,
> Christoph
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=73573#73573
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list