This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Guile/GL/GLUT and POSIX threads trick (any hope?).
Mailing-List: contact guile-help@sourceware.cygnus.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:guile-unsubscribe-beshers=cs.columbia.edu@sourceware.cygnus.com>
List-Subscribe: <mailto:guile-subscribe@sourceware.cygnus.com>
List-Archive: <http://sourceware.cygnus.com/ml/guile/>
List-Post: <mailto:guile@sourceware.cygnus.com>
List-Help: <mailto:guile-help@sourceware.cygnus.com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: guile-owner@sourceware.cygnus.com
Cc: guile@sourceware.cygnus.com
From: Jim Blandy <jimb@red-bean.com>
Date: 21 Sep 1999 19:22:49 -0500
Content-Type: text
Content-Length: 769
> > 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.
You should fire up GDB and see where things are blocked.
Keep in mind that, for now, Guile threads are non-preemptive. If GLUT
doesn't give control back to Guile when it blocks (by calling
scm_iselect, I think), then Guile threads won't run while GLUT is
waiting for input.
GLUT will never give control back. It's not designed as a full API, it's
meant to be an easy to use C-based learning environment for OpenGL.
But it's also supposed to be usable from fortran compilers, I think.
So the author made some decisions. The first is, no dangling
pointers. Everything is in arrays, and the user accesses everything
through indices. The second is, the event loop is completely hidden.
I tried GLUT for a Scheme interface as well, but gave up after talking
with the author. The source is available. You will save time by just
reading the C source for the event loop and writing it in guile/scheme
directly, or by writing a modified version in C, perhaps without the
loop, so you can just call one iteration at a time.
I switched to Scheme->C, and I wanted real objects, not integers that
hide objects, etc. I havne't cleaned up my OpenGL interface, and it
would need to be updated for guile, but I've been down the GLUT route,
and it's not the right way to go. It's good for what it's designed
for, but not much else.
Cliff
--
Clifford Beshers Computer Graphics and User Interfaces Lab
beshers@cs.columbia.edu Department of Computer Science
http://www.cs.columbia.edu/~beshers Columbia University