Hello again,

 

A couple more details on this: 

 

·         We're using OSG 2.8.2.

·         We get similar behaviour on Win XP and Win Vista.

·         We tried multiple file types for textures: PNG and JPEG.

·         In RARE cases it works with some slave cameras. That would suggest a 
threading issue...

 

Thanks again,

 

Frédéric Drolet

From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Drolet, 
Frederic
Sent: October-08-09 3:21 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Texture missing when adding slaves dynamically toosgViewer

 

Hello,

 

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 
osgViewer::frame().

 

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 
drawing;

·         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() 
again.

 

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 
primitives).

 

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 
possible?

 

Thanks for your help!

 

Frederic Drolet, M. Sc.

Computing Solutions and Experimentations | Solutions informatiques et 
expérimentations

Systems of Systems | Systèmes de systèmes

DRDC Valcartier | RDDC Valcartier

2459, boul. Pie-XI North

Quebec, Quebec

G3J 1X5 CANADA

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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to