Delivered-To: lablgtk at yquem.inria.fr Date: Tue, 16 Sep 2008 08:05:34 +0900 (JST) Message-Id: <20080916.080534.169572238.garrigue at math.nagoya-u.ac.jp> To: matthieu.dubuget at gmail.com Subject: Re: [Lablgtk] GlGtk + Thread? From: Jacques Garrigue In-Reply-To: <48CD7229.6000503 at gmail.com> References: <48CD7229.6000503 at gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: lablgtk at yquem.inria.fr Content-Type: Text/Plain; charset=us-ascii Content-Length: 1306 From: Matthieu Dubuget > I'm using lablgtk installed from godi on a linux box. > > I tried to modify the "simple.ml" example (GL sub-directory) in order to > have thread enabled: > - I replaced Main.main by GtkThread.main > - and ran the example with: lablgtk2 -thread gtkThread.cmo simple.ml > > Unfortunately, this did not work. No idea why. There is the message > (from the C part?): > > GlGtk-WARNING **: could not make current > > Any idea? > > My initial goal was to try to make a gtk application, with a separated > thread re-drawing the GlGtk area. I'm not sure of the reason, but it probably means that GL doesn't like to be called from different threads. Usually this problem of calling threads rather happens on windows, but apparently with GL this is the case for Unix too. The solution is to look at the explanations in GtkThread.mli, and issue all GL related calls through GtkThread.sync or GtkThread.async. Note that of course all calls directly from callbacks should be safe without wrappers, since they are called from the GUI thread themselves. Tell us whether it solves your problem. Cheers, Jacques _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk