[osg-users] event callback after viewer is done

Robert Osfield robert.osfield at gmail.com
Wed Oct 7 01:17:00 PDT 2015


Hi Ricky,

I don't have any suggestion for an alternate design as I still really know
enough about ImGui.  My suggestion would be to look closely at the crash
and why it's happening.

Requiring different calls to be be done in a particular order is not
unusual but having things crash when one traversal isn't followed by
another suggests a problem somewhere in the design/implementation.

Robert.

On 7 October 2015 at 08:50, Riccardo Corsi <riccardo.corsi at kairos3d.it>
wrote:

> Hi Robert,
>
> what I'm trying to do is integrating the ImGui framework and render it
> natively through osg primitives.
> This gui works in immediate mode, meaning you have to call the code to
> create your widgets every frame,
> which is what I do in the custom code in the frame loop (as this changes
> for every application).
> All the rest is handled in custom callbacks attached to some nodes.
>
> Basically, ImGui needs these things to happen in order at every frame
> 1. getting inputs (done in the event callback )
> 2. call to NewFrame() (called on the "FRAME" event, which is the last one
> received in the event callback)
> 3. code to create widgets (explicit in the main loop)
> 4. call to Render() which produces geometries to be rendered by osg (this
> is done in the update callback)
>
> Now, a call to the code that creates widgets (3.) without a proper
> NewFrame() (2.) causes a crash.
> When osgViewer is done, I don't get the event callback, and the code which
> creates the gui crashes.
>
> Any suggestion for an alternative design?
>
> Thank you,
> Ricky
>
>
>
> On Tue, Oct 6, 2015 at 8:56 PM, Robert Osfield <robert.osfield at gmail.com>
> wrote:
>
>> Hi Ricky,
>>
>> I don't know what is in your event callback but for exit to cause a crash
>> it sounds like something is probably not being managed robustly.  As I know
>> so little I can't provide any specific advice.
>>
>> One possibility might be to call viewer.eventTravseral() after the main
>> rendering loop.  I can't help be feel there is something amiss in the way
>> your are managing your event callback and it's associated faculties, and
>> suspect a small redesign could probably resolve the issue.
>>
>> Robert.
>>
>> On 6 October 2015 at 18:03, Riccardo Corsi <riccardo.corsi at kairos3d.it>
>> wrote:
>>
>>> Hi all,
>>>
>>> I have an event callback which needed to be called before some custom
>>> code I call in the main application loop, something like:
>>>
>>> while()
>>> {
>>> viewer.eventTraversal();  // << needed callback here
>>>
>>> // custom code
>>> // prepare stuff to be drawn during next frames
>>>
>>> viewer.updateTraversal();
>>> // ...
>>> }
>>>
>>> When the viewer is about to exit, the event callbacks are not called.
>>> In my case the callback is needed instead,
>>> not to cause a segfault to the custom code between osg calls.
>>>
>>> The obvious solution is to place the callback directly in the main loop,
>>> but I'd like to avoid that
>>> (to keep it more "transparent", as it's a kind of framework to be used
>>> in several applications).
>>>
>>> Have you got any suggestion?
>>> Thank you!
>>> Ricky
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151007/120f6c44/attachment-0003.htm>


More information about the osg-users mailing list