[osg-users] issue about getting the material properties from the current state in rendering info

Gianluca Natale natale at europe.altair.com
Tue Jun 23 09:05:53 PDT 2015


Hi all,
I'm using OSG 3.0.1.
I have an issue when I try to retrieve the material properties from the rendering info, in my custom drawable.

To be clearer:
I have a custom drawable, for which I implemented a

myDrawable::drawImplementation(osg::RenderInfo& osgRenderInfo).

When I try to get the material properties inside that function, by following code:

osg::StateSet  drwbStateSet;
osg::State *state = osgRenderInfo.getState();
state->captureCurrentState(drwbStateSet);

the returned material properties is invalid.
Specifically, I put a breakpoint in following function:

StateSet::setAttribute(StateAttribute *attribute, StateAttribute::OverrideValue value)

that is called inside captureCurrentState.
When the attribute is an osg::Material, the _ptr is different from the one allocated when the material has been set, in the state set associated to a parent node of that drawable.
Furthermore, _userDataContainer is 0x0000000000000000, so no valid osg::Material is returned in the captured state set.

Any idea of the possible cause of the issue? Where did I go wrong?
BTW, all other attributes (polygon offset, polygon mode, etc...) are returned correctly.

Thanks,
Gianluca Natale


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150623/77d908ed/attachment-0002.htm>


More information about the osg-users mailing list