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: 19

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 osgQt & osgEarth not working with... Db80 General 0 Thu May 16, 2019 2:15 pm View latest post
No new posts Layered rendering with a geometry shader AnyOldName3 General 8 Tue May 14, 2019 11:25 pm View latest post
No new posts Write Image From texture Generated by... GarfieldPig General 1 Wed May 08, 2019 11:42 am View latest post
No new posts Changing minFilter/magFilter of textu... Sailesh General 2 Tue Apr 16, 2019 7:12 pm View latest post
No new posts override the texture with the gl_frag... GarfieldPig General 1 Sun Apr 14, 2019 8:31 am 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