Hi Frederic,

If you are creating new graphics contexts and applying and old scene
graph to it then you can't use the
Texture::setUnRefImageDataAfterApply(true) feature of osg::Texture as
this will discard the imagery once it's applied to all the graphics
contexts that it knows about.  By default the osgUtil::Optimizer will
switch this on to save memory, so try not calling the Optimizer to see
if makes a difference.  It's possible that the original database also
has this options set, but for most databases it'll be off, which is
the default.

Robert.

On Thu, Oct 8, 2009 at 8:21 PM, Drolet, Frederic
<frederic.dro...@drdc-rddc.gc.ca> wrote:
> 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
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to