I know I solved this in MDI application somehow. My grep on _contextID found me this if it helps
/** Set the current OpenGL context uniqueID.
* The ContextID is used by classes like osg::StateAttribute's and osg::Drawable's to
* help manage seperate OpenGL objects, such as display lists, vertex buffer objects
* and texture object for each graphics context. The ContextID simply acts as an index
* into arrays that these classes maintain for the purpose of storing GL object handles.
*
* Note, osgViewer::GraphicsWindow will automatically set up the ContextID for you,
* so you will rearely need to set this yourself.
*
* The exception is when creating your own graphics context, where you should set
* the ContextID uniquely for each graphics context.
*
* Typical settings for ContextID are 0,1,2,3... up to the maximum
* number of graphics contexts you have set up. By default contextID is 0.
*/
inline void setContextID(unsigned int contextID) { _contextID=contextID; }