<div dir="ltr">Hi Gianni,<div><br></div><div>the color for the selection is white in your code (at the beginning const osg::Vec4 selectedColor(1.0f, 1.0f, 1.0f, 0.5f); ) and you have blending ON, so all is working well as you coded it ..... If you want red selection, turn off the blending and change the color ... </div><div><br></div><div>this is the snippet:</div><div><br></div><div><div>const osg::Vec4 selectedColor(1.0f, 0.0f, 0.0f, 0.5f);</div><div>const osg::Vec4 color1(1.0f, 0.0f, 0.0f, 1.0f);</div><div>const osg::Vec4 color2(0.0f, 1.0f, 0.0f, 1.0f);</div><div>const osg::Vec4 color3(0.0f, 0.0f, 1.0f, 1.0f);</div><div>const osg::Vec4 color4(1.0f, 0.0f, 1.0f, 1.0f);</div><div><br></div><div>class SelectModelHandler : public osgGA::GUIEventHandler</div><div>{</div><div>public:</div><div>    SelectModelHandler() : _selector(0), currentPrimitiveIndex(0) {}</div><div>    </div><div>    osg::Geode* createFaceSelector()</div><div>    {</div><div>        osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(1);</div><div>        (*colors)[0] = selectedColor;</div><div>        </div><div>        _selector = new osg::Geometry;</div><div>        _selector->setDataVariance( osg::Object::DYNAMIC );</div><div>        _selector->setUseDisplayList( false );</div><div>        _selector->setUseVertexBufferObjects( true );</div><div>        _selector->setVertexArray( new osg::Vec3Array(3) );</div><div>        _selector->setColorArray( colors.get() );</div><div>        _selector->setColorBinding( osg::Geometry::BIND_OVERALL );</div><div>        _selector->addPrimitiveSet( new osg::DrawArrays(GL_TRIANGLES, 0, 3) );</div><div>        </div><div>        osg::ref_ptr<osg::Geode> geode = new osg::Geode;</div><div>        geode->addDrawable( _selector.get() );</div><div>        geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );</div><div>        //geode->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );</div><div>        //geode->getOrCreateStateSet()->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 21, 2016 at 1:39 PM, Gianni Ambrosio <span dir="ltr"><<a href="mailto:g.ambrosio+osg@gmail.com" target="_blank">g.ambrosio+osg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nick,<br>
the problem I have is that I change the content of primitive sets but the color does not change in the 3D view.<br>
<br>
Regards,<br>
Gianni<br>
<span class=""><br>
------------------<br>
Read this topic online here:<br>
</span><a href="http://forum.openscenegraph.org/viewtopic.php?p=68681#68681" rel="noreferrer" target="_blank">http://forum.openscenegraph.<wbr>org/viewtopic.php?p=68681#<wbr>68681</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">trajce nikolov nick<br></div>
</div>