Hi Ethan,
You code segment looks OK, and if the the getAttribute is returning a
NULL then the most likley reason is that there in no osg::Material
attached to that particular StateSet. It's perfectly normals for
StateSet to not contain an osg::Material, so returning NULL is nothing
out of the oridinary.
To have a look at what state is attached where in your scene graph it
is best to write the scene graph out to a .osg (or .osgt) ascii file
and then simply browse the file to see what data is stored where.
Robert.
On Fri, Apr 8, 2011 at 8:19 PM, Ethan Kerzner ethan.kerz...@survice.com wrote:
Hi,
I am trying to access the material stored in a stateset. Is this possible?
My approach is below- the first line returns a null pointer.
Code:
osg::StateAttribute* sa =
myGeode.getOrCreateStateSet()-getAttribute(osg::StateAttribute::MATERIAL);
osg::Material* mat = dynamic_castosg::Material*(sa);
Thank you!
Cheers,
ethan
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38337#38337
___
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