[HOpenGL] HOpenGL and --enable-threaded-rts
Andrew J Bromage
andrew@bromage.org
Thu, 20 Jun 2002 12:31:25 +1000
G'day all.
On Thu, Jun 20, 2002 at 12:54:25AM +0200, Wolfgang Thaller wrote:
> ? I don't follow you. OpenGL can deal with multiple contexts, and it
> keeps the current context in thread-local state, so it can even deal
> with multiple contexts at the same time. We can't prevent OpenGL from
> using thread-local state. The "first version" of the proposed solution
> would only allow a single global context at one time for HOpenGL, and
> copy that to the thread-local state of every thread that executes
> haskell code.
I just had another idea. Would it be sufficient to exclusively bind a
thread to a specific (albeit arbitrary) OS thread on a temporary
basis, kind of like a lock or a transaction?
I've never seen an non-GLUT OpenGL program which needs the thread
local storage for long. Usually just for the duration of a single
update is sufficient. That way you keep the efficiency of Haskell's
thread scheduling where you can and bypass it where you can't.
Disclaimer: My experience is in visual effects. Our software ran at
"interactive" speeds, not "real time". The rules of other industries,
such as games, might be different.
Cheers,
Andrew Bromage