[osg-users] osgViewer/Renderer ctor set wrong defaults for SceneView

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Wed Feb 3 10:01:30 PST 2016


Am 03.02.2016 um 12:43 schrieb Robert Osfield:
> I suspect this is an issue with your application not setting the
> correct global state in the viewer's master Camera.  This issue was
> discussed a great deal before and shortly after the 3.2 release, but
> as you are just upgrading you have obviously missed this discussion.
>
> There was a bug prior to OSG-3.2 where SceneView would discard global
> StateSet values overwritting them with it's won global defaults.  The
> bug fix addressed this problem so users could set the viewer's
> Camera's StateSet and have this settings reflected in the scene.
>
> While this change does fix a bug it inadvertently exposed a bug in
> applications where they create their own osg::Camera without setting
> any global default state then apply this directly to the viewer.  This
> new osg::Camera then doesn't set any the defaults that are normally
> assumed to be enabled such as depth test and alpha blending etc.  The
> View(er) by default actually calls StateSet::setGlobalDefaults() but
> this is done at intiialization of the View(er) so if you then replace
> the View(er)'s Camera then you replace the one with the state set up
> with some sensible global defaults with one with no StateSet set up.
>
> The fix is to either just reuse the View(er)'s Camera rather than
> replace it, or if do replace it call:
>
>     viewer.getCamera()->getOrCreateStateSet()->setGlobalDefaults();
Hi Robert,

this was the problem.  Thanks for your fast help.


Christian




More information about the osg-users mailing list