[osg-users] Running OSG in a trhead on Mac OSX

Robert Osfield robert.osfield at gmail.com
Mon Sep 26 03:45:00 PDT 2016

Hi Kevin,

This issue with OSX is one we can't workaround, it's very much tied
into how OSX passes events from the OS onto applications.  We hit
against this issue when implementing osgViewer and trying to get the
multi-thread, mulit-context side work.  There isn't anyway to tell OSX
to give events to a thread other than the main one, the only way to
handle it is to catch all the events in the main thread and pass them
on to other threads to handle.  It's a pretty frustrating limitation,
no doubt you like many others, including myself have torn hair over
this limitation, alas there it's futile, you just have to work how
Apple wants you to write your applications even when it doesn't make
much sense for certain type of applications.


On 23 September 2016 at 17:46, Kevin Gucwa <kgucwa at ucdavis.edu> wrote:
> Hi,
> I am working on a project which requires me to put my OSG updates into a thread so that the main thread can continue for integration into another process.  All OSG events are done in the thread and locked with mutexes when i need to add new nodes.  This works perfectly on Linux and Windows and is deployed currently.  Thank you for such great software!  I am now working on the port to OSX and running into the following issue.  When I run the viewer->frame() updates in a thread, the keyboard and mouse inputs cannot register into my GUIEventHandlers.  Running the frame loop from the main thread and blocking my program allows events to be handled properly but stops my actual code from progressing.
> I am new to Mac programming but have been using OSG for a few years now.  Can anyone provide any guidance to Mac problems?  I don't have a minimal example since it is integrated into a large project.  If necessary I can write a new one which should demonstrate the problems.
> ...
> Thank you!
> Cheers,
> Kevin
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68711#68711
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list