From Aurelien Albert, "Recently I had to integrate a client OpenGL library with OSG. For textures and other StateAttribute I've done that by subclassing osg::StateAttribute and this works well.

But for glPrograms, in order to get all osg's uniform management system to work, I had to subclass osg::program::PerContextProgram.

Here is a modified version of this class, which add some "virtual" method to allow easy subclassing."