1. Basically. See osgEarth/ShaderFactory.cpp for the implementation.
2. No; the VP framework constructs a separate osg::Program for each unique combination of VirtualProgram components encountered in the scene graph traversal. Each program is compiled once, cached, and then used when needed in the scene graph.
Thanks Glenn! Yep, I have been looking over osgEarth/ShaderFactory.cpp.
Is the VP framework the only way (or perhaps the preferred or most straight forward way) to implement shading into osgEarth?
The reason I ask is in our program, we have our own ROAM implementation which over the years (and many sticky fingers) has become a problem. I'm in the process of replacing our ROAM with your osgEarth. So far I have osgEarth working in-place or our legacy ROAM implementation but there is still the matter of the shaders how best to proceed.