[HOpenGL] Pure, garbage-collected graphics resources

Conal Elliott conal at conal.net
Mon Jul 20 20:37:53 EDT 2009


I'd like to use some OpenGL resources (VBOs, textures, shaders, and shader
programs) in a functional way, with immutability, garbage collection, and
IO-free creation interfaces.  Has anyone played with doing such a thing?  I
guess the GC part would involve foreign pointers with foreign finalizers
(which now run promptly in GHC iiuc).  I don't know of any reliable way to
add finalizers to Ptr values, because of the unboxing problem [1].

One tricky issue is that graphics context initialization must take place
before any of these "pure" resources get evaluated.  If the APIs allowed
access to to multiple graphics contexts, things would get stickier.

Comments?

  - Conal

[1]
http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html#v%3AaddFinalizer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/hopengl/attachments/20090720/0b43a8ad/attachment.html


More information about the HOpenGL mailing list