<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Robert,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I see your point, nevertheless do you think that either:</div><div class="gmail_default" style="font-family:tahoma,sans-serif">- having the event callback called with an "about-to-exit" event</div><div class="gmail_default" style="font-family:tahoma,sans-serif">- having a custom callback to added and called by the viewer right before exiting</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">would be a sensible addition to osg?</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">ricky</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 7, 2015 at 10:17 AM, Robert Osfield <span dir="ltr"><<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Ricky,<br><br></div>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. <br><br>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.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">Robert.<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 7 October 2015 at 08:50, Riccardo Corsi <span dir="ltr"><<a href="mailto:riccardo.corsi@kairos3d.it" target="_blank">riccardo.corsi@kairos3d.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Robert,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">what I'm trying to do is integrating the ImGui framework and render it natively through osg primitives.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">This gui works in immediate mode, meaning you have to call the code to create your widgets every frame,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">which is what I do in the custom code in the frame loop (as this changes for every application).</div><div class="gmail_default" style="font-family:tahoma,sans-serif">All the rest is handled in custom callbacks attached to some nodes.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Basically, ImGui needs these things to happen in order at every frame</div><div class="gmail_default" style="font-family:tahoma,sans-serif">1. getting inputs (done in the event callback )</div><div class="gmail_default" style="font-family:tahoma,sans-serif">2. call to NewFrame() (called on the "FRAME" event, which is the last one received in the event callback)</div><div class="gmail_default" style="font-family:tahoma,sans-serif">3. code to create widgets (explicit in the main loop)</div><div class="gmail_default" style="font-family:tahoma,sans-serif">4. call to Render() which produces geometries to be rendered by osg (this is done in the update callback)</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Now, a call to the code that creates widgets (3.) without a proper NewFrame() (2.) causes a crash.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">When osgViewer is done, I don't get the event callback, and the code which creates the gui crashes.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Any suggestion for an alternative design?</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Ricky</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 6, 2015 at 8:56 PM, Robert Osfield <span dir="ltr"><<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Ricky,<br><br></div><div>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.<br><br></div><div>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. <br></div><div><br></div><div>Robert.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On 6 October 2015 at 18:03, Riccardo Corsi <span dir="ltr"><<a href="mailto:riccardo.corsi@kairos3d.it" target="_blank">riccardo.corsi@kairos3d.it</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi all,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I have an event callback which needed to be called before some custom code I call in the main application loop, something like:</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">while()</div><div class="gmail_default" style="font-family:tahoma,sans-serif">{</div><div class="gmail_default" style="font-family:tahoma,sans-serif">viewer.eventTraversal(); // << needed callback here<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">// custom code</div><div class="gmail_default" style="font-family:tahoma,sans-serif">// prepare stuff to be drawn during next frames</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">viewer.updateTraversal();</div><div class="gmail_default" style="font-family:tahoma,sans-serif">// ...</div><div class="gmail_default" style="font-family:tahoma,sans-serif">}</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">When the viewer is about to exit, the event callbacks are not called.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">In my case the callback is needed instead, </div><div class="gmail_default" style="font-family:tahoma,sans-serif">not to cause a segfault to the custom code between osg calls.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">The obvious solution is to place the callback directly in the main loop,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">but I'd like to avoid that</div><div class="gmail_default" style="font-family:tahoma,sans-serif">(to keep it more "transparent", as it's a kind of framework to be used in several applications).</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Have you got any suggestion?</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you!</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Ricky</div></div>
<br></div></div>_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br></blockquote></div><br></div>