plt/racket — pull request #317 by jkominek (2013-04-12 16:38:42+00:00)
Title: Support for OpenGL context sharing

These commits adds support for connecting newly created OpenGL contexts to other contexts, allowing them to share GL objects (textures, display lists, etc).

It works by adding share-context information to gl-config%, which is then picked up and used appropriately during the new context creation process.

I tested it on Windows, Linux and Mac OS X (64-bit across the board) for canvases, and checked that GL bitmaps continued to work (or at least didn't get any stranger). Underlying support should be present for this all versions of Mac OS X, and any Windows or Unix OpenGL implementation with the appropriate extensions, which became required with 3.2. (nVidia looks to have added the extension to their Windows drivers in 2008, around 3.0)

The code in https://gist.github.com/jkominek/5368570 can be used to see the sharing in action.

Let me know if you'd like any further changes.

FWIW, this was motivated by an interest in connecting OpenCL to OpenGL, which requires access to the underlying OpenGL context objects. (All I technically needed was the get-handle stuff, but I figured I'd go all the way.)