Weird behavior of SkyNode

classic Classic list List threaded Threaded
4 messages Options
ceranco ceranco
Reply | Threaded
Open this post in threaded view
|

Weird behavior of SkyNode

Hello,

I have encountered weird behavior while using SkyNode in an application that needs to create and remove a viewer dynamically. The first time that I open a viewer and use a MapNode with a SkyNode everything works as expected, but the second time the atmosphere effect doesn't seem to work, I have a huge ball behind the MapNode and I get 'Warning: detected OpenGL error 'invalid value' at after RenderBin::draw(..)'

I am using OpenSceneGraph 3.4.1 and osgEarth 2.8.0

Here is a code sample that demonstrates the problem:

int main(int argc, char** argv)
{
        while (true)
        {
                osg::ref_ptr<osg::Group> root = new osg::Group;
                osg::ref_ptr<osgEarth::MapNode> mapNode = new osgEarth::MapNode;
                osg::ref_ptr<osgEarth::Util::SkyNode> skyNode = osgEarth::Util::SkyNode::create(mapNode.get());

                osgEarth::Util::insertGroup(skyNode, mapNode);
                root->addChild(mapNode.get());

                osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
                skyNode->attach(viewer.get());
               
                viewer->setSceneData(root.get());
                viewer->apply(new osgViewer::SingleWindow(50, 50, 1000, 1000));

                viewer->run();
        }
        return 0;
}

This is how it looks the first time, working as expected:


and here is how it looks the second time, with the errors:



I couldn't find the reason for the problem, so I'd be glad if anyone has any insights .

Many thanks
Eran Cohen
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior of SkyNode

Hi Eran,

That is interesting -- dont' know the answer off the top of my head. Would you please open a GitHub issue for this? Thanks.
Glenn Waldron / Pelican Mapping
ceranco ceranco
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior of SkyNode

Hi Glenn,

Sure thing, I have opened it: https://github.com/gwaldron/osgearth/issues/1055
Eran Cohen
ceranco ceranco
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior of SkyNode

In reply to this post by ceranco
It seems that the problem might stem from the "SkySimple Atmosphere" osg::Program.
On the second time loop with osg notify level set to "INFO", I get this error:

glValidateProgram FAILED "SimpleSky Atmosphere" id=7 contextID=0

Eran Cohen