> 
> Unfortunately, my applicaton crashes and I dont know what I am
> doing wrong here :-( It works when I dont call 'drawAnimated()' in
> the thread, but then it becomes useless :-(
> 

You don't show what it is you are doing in your drawAnimated method, so
it is hard to judge what you might be doing wrong.

However, if it is *actually* calling drawing methods, that is unlikely
to work, the window is unlikely to be the current drawing object at the
point your thread code runs - you can really only draw things from
within the widgets draw method, which you can not call - you must let
fltk call that for you.

Now, with fltk-1, you *might* be able to make this work by judicious use
of make_current() and so forth. But I suspect not - and that would be
"bad form" anyway. And make_current() is dropped from fltk-2, I think...

So... Really, what you need is for your worker thread to compute the
details of the new scene, and store it somewhere, then call awake() from
the worker thread.
The widgets draw method will then (or very soon after) be called by the
main thread, and it should then read and interpret the scene details
generated by the worker thread...

Well, something like that, anyway.
-- 
Ian

SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to