<div dir="ltr"><div><br></div><div>Hi Jose,</div><div>You may have a black background, with the blending actually (partly) working, changeĀ </div><div>getCamera()->setClearColor( osg::Vec4(r,g,b,a) );<br></div><div>to see if that's the case.</div><div>the stuff that needs blending needs to be rendered after the background, normally done with:</div>stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);<div><br></div><div>If it's not blending at all I would recommend you to check if your image did not end up as an RGB image instead of RGBA.</div><div>Regards, Laurens.</div><div><br></div><div><br><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 2, 2018 at 11:28 AM Jose Pedro Canilho <<a href="mailto:jpc_ace@hotmail.com">jpc_ace@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_3733428938383503358divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi everyone!<br>
<br>
I've been battling with this issue for a couple of days and could really use some assistance. I'm fairly new to OSG (and 3D rendering in general) so I might be doing some rookie mistake.<br>
<br>
</p>
<p style="margin-top:0;margin-bottom:0">In my program, I draw several quads, each containing a RGBA squared image.
<br>
</p>
<p style="margin-top:0;margin-bottom:0">At one point, I'm required to draw a new image on top of the existent images. This new image is also squared, but it is partially transparent (i.e., several pixels have the RGBA value of 0,0,0,0). At the moment, these
pixels are being rendered black instead of transparent, and thus are mistakenly covering some regions of the background images/quads.<br>
<br>
After quite a few searches online, I was pointed in the direction of the GL_BLEND macro and blend functions. I tried to enable blending for the new image/quad:<br>
</p>
<div style="color:#d4d4d4;background-color:#1e1e1e;font-family:'Droid Sans Mono','monospace',monospace,'Droid Sans Fallback';font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap">
<div><span style="color:#569cd6">auto</span><span style="color:#d4d4d4"> qss </span>
<span style="color:#d4d4d4">=</span><span style="color:#d4d4d4"> </span><span style="color:#9cdcfe">quad</span><span style="color:#d4d4d4">-></span><span style="color:#dcdcaa">getOrCreateStateSet</span><span style="color:#d4d4d4">();</span></div>
<div><span style="color:#d4d4d4">qss-></span><span style="color:#dcdcaa">setMode</span><span style="color:#d4d4d4">(GL_BLEND, osg::StateAttribute::ON)</span></div>
</div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">but to no avail.</p>
<p style="margin-top:0;margin-bottom:0">I also tried to attach a blend function to the quad, like such:</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div style="color:#d4d4d4;background-color:#1e1e1e;font-family:'Droid Sans Mono','monospace',monospace,'Droid Sans Fallback';font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap">
<div><span style="color:#d4d4d4">osg::BlendFunc</span><span style="color:#d4d4d4">*</span><span style="color:#d4d4d4"> blendFunc
</span><span style="color:#d4d4d4">=</span><span style="color:#d4d4d4"> </span>
<span style="color:#c586c0">new</span><span style="color:#d4d4d4"> </span><span style="color:#dcdcaa">osg::BlendFunc</span><span style="color:#d4d4d4">(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA );</span></div>
<div><span style="color:#d4d4d4">qss-></span><span style="color:#dcdcaa">setAttributeAndModes</span><span style="color:#d4d4d4">(blendFunc);</span></div>
</div>
<br>
<p></p>
<p style="margin-top:0;margin-bottom:0">but that didn't work either.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Are there any other issues that I might be overlooking here?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks in advance.<br>
</p>
</div>
</div>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>