<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">Am 23.06.2015 18:05, schrieb Gianluca
Natale:<br>
</div>
<blockquote
cite="mid:E68303BA4516E5488D7BFD551AE34BC17420DFFA@euexch2.Europe.altair.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I’m using OSG 3.0.1.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have an issue when I
try to retrieve the material properties from the rendering
info, in my custom drawable.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">To be clearer:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have a custom
drawable, for which I implemented a<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">myDrawable::drawImplementation(</span><span
lang="EN-US">osg::RenderInfo& osgRenderInfo</span><span
lang="EN-US">).<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">When I try to get the material properties
inside that function, by following code:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">osg::StateSet drwbStateSet;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">osg::State *state =
</span><span lang="EN-US">osgRenderInfo.getState();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">state->captureCurrentState(</span><span
lang="EN-US">drwbStateSet</span><span lang="EN-US">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">the returned material properties is invalid.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">Specifically, I put a breakpoint in following
function:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none">StateSet::setAttribute(StateAttribute
*attribute, StateAttribute::OverrideValue value)<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">that is called inside captureCurrentState.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">Furthermore, _userDataContainer is
0x0000000000000000, so no valid osg::Material is returned in
the captured state set.</span></p>
</div>
</blockquote>
User data defaults to nullptr. So if you're not setting it up that
is expected.<br>
As you don't explain why you are trying to inspect state during draw
it is hard to guess what you are after.<br>
I simply guess that your state is set up somewhere further up in the
stategraph (i.e. in one of the parents) and that state is set up
lazy. <br>
Maybe Robert can give some insights here. <br>
<br>
<br>
<blockquote
cite="mid:E68303BA4516E5488D7BFD551AE34BC17420DFFA@euexch2.Europe.altair.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">Any idea of the possible cause of the issue?
Where did I go wrong?<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">BTW, all other attributes (polygon offset,
polygon mode, etc…) are returned correctly.</span></p>
</div>
</blockquote>
Are you sure you are setting up an osg::Material state attribute
somewhere?<br>
<blockquote
cite="mid:E68303BA4516E5488D7BFD551AE34BC17420DFFA@euexch2.Europe.altair.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US">Gianluca Natale<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
lang="EN-US"><o:p> </o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
osg-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a>
</pre>
</blockquote>
<br>
</body>
</html>