Note that there are some explanatory texts on larger screens.

plurals
  1. POforce FLTK to redraw without event Handles
    text
    copied!<p>I'm using Fltk to render openGL graphs. currently I'm debugging a global array which is sorted by a heapsort function. My purpose is to see after each swap of elements in the heapsort function a graphical swap of elements. but I don't want to catch an event from FLTK event_handle for every time i need to redraw after I swapped and waiting at breakpoint. (the heapsort function and the opengl render part are running in 2 different threads (if that doesn't has to go without saying)). So the first try I had was to use:</p> <pre><code>Fl::add_timeout(1.0, MyRedrawCallback, (void *)&amp;myWindow); Fl::run(); void MyRedrawCallback(void *myWindow) { MyWindow *pMyWindow; pMyWindow = (MyWindow *) myWindow; pMyWindow-&gt;redraw(); Fl::repeat_timeout(1.0, MyRedrawCallback, (void *)&amp;pMyWindow); } </code></pre> <p>But every Time the callback is called the 2nd time i get an "Access violation reading"</p> <p>I'm suggesting that FL::run starts a different thread so maybe the first time is still in same thread so the address of redraw is still usable but after that I'm in a different thread and the function at address is not that what I'm expecting?!</p> <p>But I already took a different way because I wasn't sure i cant even use the timeout on this way. So i was looking for a way to get an event that's eq to "set amount of time passed" or "nothing is happening for..." but there isn't such a handle I'm right?</p> <p>Finally is there a way to let FLTK execute commands even outside the eventloop? or is there another way to solve my problem?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload