black splotches zooming in

classic Classic list List threaded Threaded
1 message Options
bclay bclay
Reply | Threaded
Open this post in threaded view

black splotches zooming in

I am using osgearth version 3 code with Visual Studio on windows 10.

When I add a sky node from code I get black splotches when I zoom in.  They only appear while zooming and clear up when zoom is finished.  I add the sky from code because  the sliders always show when I add it from the earth file.  

With this code I have to put the moon file in the executable directory or it is not found.  I know there is a fromConfig call that would allow me to set the URL of the moon file but it is a private method and not accessible.  Also I could not find any example of how to use the fromConfig call nor a JSON config file to work with the sky node

If I can get rid of the flashing I could live with the moon file issue.

the code I am using to create the sky follows.

int Environment::CreateSkyNode(float ambientLighting)
        int status = -1;

        if ((mMapNode != NULL) && (mViewerView != NULL))
// get current date and time and convert to zulu time

                time_t currTime = time(NULL);

                struct tm *timeptr = gmtime(&currTime);

                mSkyYear = timeptr->tm_year + 1970;
                mSkyMonth = timeptr->tm_mon + 1;
                mSkyDay = timeptr->tm_mday;

                mSkyHours = timeptr->tm_hour;
                mSkyMinutes = timeptr->tm_min;

                float skyTime = (float)mSkyHours + (float)mSkyMinutes / 60.0f;

                osgEarth::SkyOptions *skyOptions = new osgEarth::SkyOptions;
                skyOptions->hours() = skyTime;
                skyOptions->ambient() = ambientLighting;

                mSkyNode = osgEarth::Util::SkyNode::create(*skyOptions);


                mSkyNode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE);


                mSkyNode->attach(mViewerView, 0);