Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#62 Possibility for main event loop not in C

open
nobody
Easy (28)
5
2009-06-08
2009-06-08
Anonymous
No

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!

Tobias Rittweiler
tcr, at, freebits, dot, de

Discussion

  • This is a rather old item i see, but the patch would be welcome so we can evaluate it. Simple changes making more possible are always welcome.

    As a second thing, if we add this to the lib, would you be willing to provide a short doc detailing your usage case and some example code? I think many could profit from that.