HI Alexis,

This looks like an issue with your application setting up the viewer
Camera's without initializing the Camera's StateSet to global
defaults.  3.0.x and 3.1.x have a bug where the internal rendering
setup overrides the Camera's StateSet forcing the global defaults so
would hide where this wasn't done correctly so in effect hid this bug
in client applications.

In OSG-3.2.x If you use osgViewer::View(er)'s default Camera it will
by default set the the StateSet global defaults that you can then
override if you wish, but if you apply your own osg::Camera in place
of this it won't have the StateSet's set up with global defaults and
will just what you set it up with, and if you don't provide any then
it'll be just OpenGL defaults which won't enable key things like depth
test.

The simple solution is to reuse the View(er) Camera rather than
replacing it, or if you do replace it call
StateSet::setGlobalDefaults() on the Camera StateSet that you are
applying.

Robert.

On 9 April 2014 08:51, alexis pierre <[email protected]> wrote:
> Hi,
>
> I am trying to update a code that was working on 3.1.2. A osg::Node is loaded 
> from a stl file using osgDB::readNodeFile.
> The Node is a Group with one Geode with one geometry.
> There is a problem with the colors. The only code difference between osg 
> 3.2.0 and osg 3.1.2 is where I set the colors:
>
>
> Code:
>
> void Mesh::setColor(osg::Vec4 color) {
> #if OSG_VERSION_GREATER_OR_EQUAL(3, 2, 0)
>         osg::Geometry* geometry = 
> meshNode_->asGroup()->getChild(0)->asGeode()->getDrawable(0)->asGeometry();
>         osg::Vec4Array* colors = new osg::Vec4Array;
>         colors->push_back(color);
>         colors->setBinding(osg::Array::BIND_OVERALL);
>         geometry->setColorArray(colors);
> #else
>         osg::Geometry* geometry = 
> this->meshNode_->asGeode()->getDrawable(0)->asGeometry();
>         osg::Vec4Array* colors = new osg::Vec4Array;
>         colors->push_back(color);
>         geometry->setColorArray(colors);
>         geometry->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET);
> #endif
>
> }
>
>
>
> The result I get are shown in the pictures attached. Do you have any idea 
> where this could come from?
>
> Thank you!
>
> Cheers,
> alexis
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=58826#58826
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/osg312_109.png
> http://forum.openscenegraph.org//files/osg320_786.png
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to