Something like

Qt Code:
  1. #IFDEF Q_OS_WIN
  2. HGLRC rc = wglGetCurrentContext();
  3. #ELSE
  4. GLXContext rc = glXGetCurrentContext();
  5. #ENDIF
To copy to clipboard, switch view to plain text mode 

in the intializeGL() or paintGL() methods of a QGLWidget will probably get the necessary rendering contexts. I've proved the Windows leg first with an OpenCascade OpenGL viewer - the alternate piece is the logical extension for X11.

Pete