<div dir="ltr">On 19 April 2018 at 20:30, Rowley, Marlin R <span dir="ltr"><<a href="mailto:marlin.r.rowley@lmco.com" target="_blank">marlin.r.rowley@lmco.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div class="m_3232683162218490192WordSection1">
<p class="MsoNormal">I thought the sampler value was a pointer to a texture?<u></u><u></u></p>
<p class="MsoNormal"></p></div></div></blockquote><div><br></div><div>Where did you get that idea? None of the OSG example attempt this. When using OpenGL you pass the sampler uniforms as int, when it comes to OpenGL the OSG is just a lightweight wrapper around it. <br></div><div><br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-US"><div class="m_3232683162218490192WordSection1"><p class="MsoNormal"> </p>
<p class="MsoNormal">I set the texture unit to 1 because we’ll need the base texture unit 0 later on. My goal is to turn on up to 10 texture units and blend them all together.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">To be more clear, he is some more code:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="background:#1e1e1e"><span style="font-size:14.5pt;font-family:Consolas;color:#dadada">mGroupState </span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">=</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> mBoundGeometry</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">-></span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8"><wbr>getOrCreateStateSet</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">();</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:#1e1e1e"><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> mGroupState</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">-></span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">getOrCreateUnifor<wbr>m</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">(</span><span style="font-size:14.5pt;font-family:Consolas;color:#d69d85">"BaseTexSampler"</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">,</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> </span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">osg</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">::</span><span style="font-size:14.5pt;font-family:Consolas;color:#4ec9b0">Unifo<wbr>rm</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">::</span><span style="font-size:14.5pt;font-family:Consolas;color:#b8d7a3">SAMPLER_2D</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">)-></span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">set</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">(</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada">mBaseColo<wbr>r</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">.</span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">get</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">());</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:#1e1e1e"><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> mGroupState</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">-></span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">getOrCreateUnifor<wbr>m</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">(</span><span style="font-size:14.5pt;font-family:Consolas;color:#d69d85">"BaseWeight"</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">,</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> </span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">osg</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">::</span><span style="font-size:14.5pt;font-family:Consolas;color:#4ec9b0">Uniform</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">::</span><span style="font-size:14.5pt;font-family:Consolas;color:#b8d7a3"><wbr>FLOAT</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">)-></span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">set</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">(</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada">mBaseWeight</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">);</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:#1e1e1e"><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> mGroupState</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">-></span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">setTextureAttribu<wbr>teAndModes</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">(</span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">BASE_TEXTURE_UNIT</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">,</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> <wbr>mBaseColor</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">,</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"> </span><span style="font-size:14.5pt;font-family:Consolas;color:#c8c8c8">osg</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">::</span><span style="font-size:14.5pt;font-family:Consolas;color:#4ec9b0">StateAttribut<wbr>e</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">::</span><span style="font-size:14.5pt;font-family:Consolas;color:#b8d7a3">ON</span><span style="font-size:14.5pt;font-family:Consolas;color:#b4b4b4">);</span><span style="font-size:14.5pt;font-family:Consolas;color:#dadada"><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This sets the base texture unit 1 to be bound to the mBaseColor (which is a osg::ref_ptr<osg::Texture2D>) created before the function call.<u></u><u></u></p>
<p class="MsoNormal"><u></u></p></div></div></blockquote><div><br></div><div>I tell you want the problem is and you copy and paste more code with that exact problem in. Pass in an int value for the sampler texture unit, so BASE_TEXTURE_UNIT, not the texture pointer.<br><br></div><div>For future reference, could you refrrame from using this black and white blocks, it's painful to look at. Just putting everything in plain texture but using indentation for code is perfectly fine.<br><br></div><div>Robert.<br></div><div><br></div></div></div></div>