ImageEngine/gaffer — pull request #343 by johnhaddon (2013-06-04 02:56:24+00:00)
Title: Fixed GLWidget for use inside Maya 2013.

In Maya 2012, we were able to introspect the Maya widget hierarchy and find a QGLWidget owned by maya, which we could then use to enable sharing of OpenGL resources between Gaffer QGLWidgets and Maya ones. In Maya 2013, it appears that Maya no longer uses QGLWidgets at all, so that approach didn't work. We now use MHardwareRenderer.makeResourceContextCurrent() to get the OpenGL context maya uses for resource sharing and make our own contexts sharing with it via glXCreateContext().

This approach seems more robust in that it uses official Maya API's rather than cheeky poking around, but it has downsides which are largely due to Qt's GLContext API. Although QGLContext claims to be subclassable, and we can override chooseContext() to create a context the way we want, there appears to be no really good place to call glXDestroyContext(), as documented in the code comments.