[osg-users] Getting LigtModel from viewer

Robert Osfield robert.osfield at gmail.com
Mon Apr 8 00:45:22 PDT 2019

Hi Claudio,

On Mon, 8 Apr 2019 at 00:16, Claudio Benghi <claudio.benghi at gmail.com> wrote:
> I'd like to be able to toggle the setTwoSided() value of the LightModel that gets instantiated with the default osg::viewer class.
> I've looked at the code a while but I can't find a way to get the instance of LightModel from the instance of the viewer. I suppose it's attached to the global state that gets instantiated in the sceneView class, but I'm not sure how to get to that one either.
> Any help much appreciated.

I have a quick look and it looks like the only assignment of
LightModel by dfault is done by osgUtil::SceneView's setDefaults(),
this is assigning the LightModel to the SceneView::_globalStateSet
which itself is set by the osgViewer::Renderer which assigns the
Camera's StateSet as the global default.   It's rather convoluted, a
bit of hang up of the OSG evolving over many years and at each step
trying to avoid breaking end user code.

So.... you should be able to do something like:



More information about the osg-users mailing list