[osg-users] Dragger::setupDefaultGeometry changes lighting

2012-01-13 Thread Philipp Moeller
I want to add a TrackballDragger to a simple geometry (triangles,
normals calculated by SmoothingVisitor, colors, no other state set). My
viewer is configured with setLightingMode(osg::View::SKY_LIGHT). And my
graph looks really just like this:

root
   /\
  /  \
 /   MatrixTransform
/  \
Dragger \
   Geometry

Dragging works perfectly but the lighting for the Geometry changes (goes
dark) and even setting GL_LIGHTING to ON | PROTECTED does not change
anything.

The change is introduced by TrackballDragger::setupDefaultGeometry but I
cannot see where the code should set a StateAttribute that would affect
lighting in my geometry.

Any hints how to debug this further or which StateAttributes need to be
enabled in my geometry?

Cheers,
Philipp Moeller
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dragger::setupDefaultGeometry changes lighting

2012-01-13 Thread Robert Osfield
Hi Philip,

Check your geometry to see if it has normal and colour arrays, it
could be that these are missing so it's inheriting the values from the
manipulator geometry.

Robert.

On 13 January 2012 11:21, Philipp Moeller
philipp.moel...@geometryfactory.com wrote:
 I want to add a TrackballDragger to a simple geometry (triangles,
 normals calculated by SmoothingVisitor, colors, no other state set). My
 viewer is configured with setLightingMode(osg::View::SKY_LIGHT). And my
 graph looks really just like this:

        root
       /    \
      /      \
     /   MatrixTransform
    /          \
 Dragger         \
               Geometry

 Dragging works perfectly but the lighting for the Geometry changes (goes
 dark) and even setting GL_LIGHTING to ON | PROTECTED does not change
 anything.

 The change is introduced by TrackballDragger::setupDefaultGeometry but I
 cannot see where the code should set a StateAttribute that would affect
 lighting in my geometry.

 Any hints how to debug this further or which StateAttributes need to be
 enabled in my geometry?

 Cheers,
 Philipp Moeller
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dragger::setupDefaultGeometry changes lighting

2012-01-13 Thread Philipp Moeller
Robert Osfield robert.osfi...@gmail.com writes:

 Hi Philip,

 Check your geometry to see if it has normal and colour arrays, it
 could be that these are missing so it's inheriting the values from the
 manipulator geometry.

Indeed my normals were missing. I had an updateCallback set on my
Geometry that didn't apply SmoothingVisitor to the parents. Although
the way I do it now looks highly inefficient to me.

// g is the geometry the visitor is acting upon
auto parents = g-getParents();
for(auto x : parents)
  if(Geode* geo = x-asGeode())
geo-apply(smoothingVisitor);

Is there a subcomponent of SmoothingVisitor that can be applied to a
Drawable instead of a Geode? I image it should be somewhere in the
eternals already, but this seems useful to me. 

Philipp


 Robert.

 On 13 January 2012 11:21, Philipp Moeller
 philipp.moel...@geometryfactory.com wrote:
 I want to add a TrackballDragger to a simple geometry (triangles,
 normals calculated by SmoothingVisitor, colors, no other state set). My
 viewer is configured with setLightingMode(osg::View::SKY_LIGHT). And my
 graph looks really just like this:

        root
       /    \
      /      \
     /   MatrixTransform
    /          \
 Dragger         \
               Geometry

 Dragging works perfectly but the lighting for the Geometry changes (goes
 dark) and even setting GL_LIGHTING to ON | PROTECTED does not change
 anything.

 The change is introduced by TrackballDragger::setupDefaultGeometry but I
 cannot see where the code should set a StateAttribute that would affect
 lighting in my geometry.

 Any hints how to debug this further or which StateAttributes need to be
 enabled in my geometry?

 Cheers,
 Philipp Moeller
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org