OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Shader Program stops working after Changing Viewer GraphcsContext or Viewer


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
ceranco (Eran Cohen)
Newbie


Joined: 15 Dec 2017
Posts: 10

PostPosted: Mon May 21, 2018 3:09 pm    Post subject:
Shader Program stops working after Changing Viewer GraphcsContext or Viewer
Reply with quote

Hi,

I implemented a 'PausableViewer', to enable dynamically 'hiding' and 'showing' the window. I did it in the following way:
On pause, I set done to true, create a new GraphicsContext with the same traits of the previous GraphicsContext, stop the viewer threading and switch them -
Code:
pause()
{
   auto traits = new GraphicsContext::Traits(*getCamera()->getGraphicsContext()->getTraits());
   auto gc = GraphicsContext::create(traits);
   
   stopThreading();
   getCamera()->setGraphicsContext(gc);
   setDone(true);
}


On resume, I resume the threading and set done to false -
Code:
resume()
{
   setDone(false);
   startThreading();
}



This works well, but when using with osgEarth's SkyNode as the scene data of the viewer, after the second context switch and onward, I get these errors in a loop:

glValidateProgram FAILED "" id=4 contextID=0
glValidateProgram FAILED "SimpleSky Atmosphere" id=7 contextID=0
Warning: detected OpenGL error 'invalid operation' at RenderBin::draw(..)


I can also recreate the error using a regular Viewer, by closing a Viewer but saving the scene data and giving it to a new Viewer:

Code:
ref_ptr<Group> root = new Group;
auto mapNode = new MapNode;
auto skyNode = SkyNode::create(mapNode);

skyNode->addChild(mapNode);
root->addChild(skyNode);

while (true)
{
   Viewer viewer;
   viewer.setCameraManipulator(new EarthManipulator);
   viewer.setSceneData(root);
   viewer.run();
}


I know that this problem might stem from the osgEarth side of things, and I've asked there, but I'm wondering if anyone might have a clue to why this happens.

Cheers,
Eran
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Viewer not working bakalarvae Build system [build] 4 Sun May 27, 2018 8:20 pm View latest post
No new posts Shader composition with multiple func... hartwigw General 1 Sat May 12, 2018 9:59 pm View latest post
No new posts EXTERNAL: Re: EXTERNAL: Re: FBO setup... Rowley, Marlin R General 0 Thu May 10, 2018 12:56 pm View latest post
No new posts EXTERNAL: Re: FBO setup not working.. Rowley, Marlin R General 1 Thu May 10, 2018 12:49 pm View latest post
No new posts FBO setup not working.. Rowley, Marlin R General 3 Wed May 09, 2018 5:47 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP