Hi Everyone:
I'm seeing behavior in my application whereby an osg Window will come up, but
won't respond to any events for a few (sometimes 10 or more seconds).
Rendering is happening during this time, but no event processing.
I tracked it down to the following:
1. The event queue is constructed and initializes _startTick
2. Some events are pushed onto the queue (not explicitly, could be mouse
move, etc)
3. Some time passes (generally related to model loading - we are using
osgEarth)
4. Rendering starts and calls setStartTick() on the event queue with a new
time.
5. takeEvents() is called during event traversal, but because the
startTick has been reset, the top event is in the "future" and takeEvents()
returns nothing.
6. Eventually enough time passes so that the event is no longer in the
"future" and event processing starts happening.
The time that the stall lasts for is clearly related to how long step 3 takes -
which can be lengthy when osgEarth is fetching stuff off the network.
I fixed it by clearing out the events when setStartTick is called, viz:
void EventQueue::setStartTick(osg::Timer_t tick)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_eventQueueMutex);
// Since setting the start tick effectively invalidates the time
// of any events already in the queue, clear it out
_eventQueue.clear();
_startTick = tick;
}
I haven't got a sample that reproduces the behavior, but it seems to make sense
that if the startTick is reset, all the existing events are toast? I'm not
sure why no one else has seen this - maybe our usage pattern is different from
the norm?
Cheers
Anthony
Anthony Nixon
Modelling & Simulation Architect
Systems Analysis Laboratory (SAL)
Strategic Development & Experimentation - International
Boeing Defence Australia Ltd
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org