This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Guile/GL/GLUT and POSIX threads trick (any hope?).


Jim Blandy <jimb@red-bean.com> writes:

> You could call scm_boot_guile, and then have your inner_main function
> call the glut main loop.  Either write your own repl suitable for
> invocation from glut callbacks, or make a separate Guile thread and
> have that call the repl.  In the latter case, you'll need a glut lock.

Well, I tried that (but using gh_enter rather than scm_boot_guile --
does that matter?), and calling gh_repl from a guile thread before
entering glutMain, but this seemed to lock things up.  I didn't have a
lock around the scheme code, but I'm not sure that was the problem.
I wanted to have code that I could call from the repl that would do
stuff like this:

  (draw-window-contents)
  (swap-buffers)
  (wait)
  (draw-window-contents-differently)
  (swap-buffers)
  (wait)

and then return.  But as I recall the updates never appeared until the
entire function finished and control returned back to glutMain, even
if I called glFinish or glFlush.  For the time being, accomodating
this would have required too many code changed to deal with..

In my current (non-GLUT) approach, since the gui is running in a
separate guile thread via repeated calls to gtk_main_iteration, I can
do all kinds of things from the REPL, and the results show up
immediately.  I haven't scratched my head yet to decided if I also
need a guile gui mutex here too, but I probably do.  I haven't been
bitten yet, and right now this is just a quick demo, but I'll have to
clean it up later, or I'll likely regret it.

For those of you who've asked about the GL/Guile stuff, I'll get back
to you soonish, but I'm swamped right now, so it may be a bit.  If I
forget, remind me in a few days.

Thanks

-- 
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]