Let's say we want to use Glut in another language than C, this is easily doable
via an FFI (Foreign Function Interface.) Now, the language's implementation may
not support native threads, but green threads only. This means that calling into
foreign code blocks all other threads.
In this scenario, the main event loop must be written in that language, not in C,
so the language's thread scheduler has a chance to run.
FreeGlut provides `glutMailLoopEvent' which is a step in the right direction, but
does not suffice (AFAICS.) You also need to expose X's ConnectionNumber,
where the main event loop in the other language can poll on. And you also need
access to Glut's ExecState to find out when the user closed the window.
I locally modified FreeGlut to expose both things via `glutGet' which works
perfectly. The modifications are trivial (adding two constants, and two switch cases),
so I won't provide a patch, unless you want me to.
Thanks for all your work!
tcr, at, freebits, dot, de
Log in to post a comment.