I am working on a project were the scene graph is persistent but Viewers are created and destroyed dynamically.
I'm keeping the root node in a ref_ptr, and whenever a new Viewer is created. I set it's scene data like so:
I've come across a problem when using a SkyNode in the scene graph:
On the first Viewer, things work mostly as expected (Atmosphere, Sun and Moon work, but the Stars are not showing), but from the second Viewer and onward, the Atmosphere does not work, the Sun shows as a huge white planet, but weirdly the stars become visible.
I've been able to reproduce the problem on multiple Windows 7 computers with the following code:
ref_ptr<Group> root = new Group;
auto mapNode = new MapNode;
auto skyNode = SkyNode::create(mapNode);
for(int i = 0; i < 3; i++)
I'm using OpenSceneGraph 3.6.0 and osgEarth 2.9, but have reproduced this problem on osgEarth master branch.
Also, if I create two Viewers together and share the scene graph, everything works okay until one is closed and then a new Viewer opened. It seems that the problem is somehow related to the Viewer closing.
Has anyone encountered such a problem before, or has an idea?