Hi David,

I really don't know what is up with your usage, there really isn't
enough info about how you set up things to know where things are going
astray.

A window being black suggest to be that rendering itself hasn't
started yet, just that the window has been realized.  The osgViewer
doesn't support multiple viewers sharing a single GraphicsContext
(this is what you should use osgViewer::CompositeViewer for so you can
have multiple views sharing a single context).

Robert.

On Wed, Aug 13, 2008 at 7:09 PM, David Johansson <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I have a problem with threading and osg::Viewer.
>
> Basically i create and recreate a bunch of threads that runs a new
> Viewer instance and the problem is that the viewers 'draw area' turns
> up black if i ever close a Viewer.
>
> Thread1 creates Window1 - viewing Node1 - OK.
> Thread2 creates Window2 - viewing Node1 - Ok.
> User closes Window1
> Thread1 dies.
> Thread3 creates Window3 - viewing Node1 -- Will turn up black
> Thread4 creates Window4 - viewing Node1 -- All Ok..
> Thread5 creates Window5 - viewing Node1 -- Also Ok
> User closes window 2
> Thread2 dies.
> Thread6 creates Window6 - viewing Node1 -- Will turn up black
> Thread7 creates Window7 - viewing Node1 -- Ok again.
> User closes all windows
> Thread3 - 7 dies.
> Thread8 creates Window8 - viewing Node1 -- Black.
> Thread9 creates Window9 - viewing Node1 -- Black.
> Thread10 creates Window10 - viewing Node1 -- Black.
> Thread11 creates Window11 - viewing Node1 -- Black.
> Thread12 creates Window12 - viewing Node1 -- Black.
> Thread13 creates Window13 - viewing Node1 -- Ok!
>
> I noticed that After closing all windows, i had 5 windows running that
> acctually showed something(5 new Contexts??). After that i had to
> create 5 threads (that were black) until getting a new view that
> wasn't black.
>
> Looking through the code my guess is that "graphicsContexts" are
> getting reused, however not reset or something like that.
>
> This is the code i use to set-up my viewers:
>
> osgViewer::Viewer viewer;
> viewer.addEventHandler(new osgViewer::StatsHandler());
> viewer.addEventHandler(new osgViewer::ThreadingHandler());
> viewer.addEventHandler(new osgViewer::WindowSizeHandler());
> viewer.setSceneData(g);
> viewer.setThreadingModel(osgViewer::Viewer::ThreadPerContext); /**/
> viewer.run();
>
> Any help would be great!
>
> Regards,
>
> David Johansson
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to