I'm having trouble with textures on slave cameras added to an osgViewer. 
Textures won't appear if I add the slaves after a first call to 


My application is composed of a rendering thread calling osgViewer::frame() 
every 15 ms (for a 60 Hz framerate) and a main thread handling windows and 
menus interactions (using MFC on Windows). One of those interactions is to add 
and remove camera slaves on the go (adding a projection and camera offset for 
multiple points of view). Here's the steps I follow to add a slave camera:


·         Pause my rendering thread calling osgViewer::frame() and wait for it 
to be idle;

·         Call osgViewer::stopThreading() to make sure the last frame is done 

·         Create a child window with its own graphics context;

·         Add a slave to osgViewer using the newly created window handle (each 
slave camera uses its own osg::GraphicsContext object);

·         Call osgViewer::realize() to reinitialize the viewer and start 
threading again;

·         Unpause my rendring thread which starts calling osgViewer::frame() 


I use a similar approach to destroy slaves. Everything works fine except for 
the textures which are not displayed on the slave windows (but I can see the 


Note that if I add slaves before the first call to osgViewer::frame(), textures 
are ok. But removing and adding them again makes the textures disappear. 


I tried all the threading models in osgViewer, I also tried to share the 
"master" context in the osg::GraphicsContext::Traits object of every slave. 
None of those solutions is working. My comprehension of OpenGL state sets is 
limited so I'm probably missing something here.


What am I doing wrong? Is adding slaves dynamically to an osgViewer even 


Thanks for your help!


Frederic Drolet, M. Sc.

Computing Solutions and Experimentations | Solutions informatiques et 

Systems of Systems | Systèmes de systèmes

DRDC Valcartier | RDDC Valcartier

2459, boul. Pie-XI North

Quebec, Quebec


Phone | Téléphone: (418) 844-4000 ext : 4820

Fax | Télécopieur: (418) 844-4538

E-mail | Courriel: frederic.dro...@drdc-rddc.gc.ca 

Web : www.valcartier.drdc-rddc.gc.ca <http://www.valcartier.drdc-rddc.gc.ca> 

osg-users mailing list

Reply via email to