Hi Paul,
ShaderGen does do shader composition, does it not? Just in a very limited way.
Well, it's kind of a "hard-coded" shader composition - it's a visitor that takes the accumulated states at a given node, and generates a string containing the shader needed to render (the supported subset of) those states from strings containing fragments for each supported state. You don't have external access to change these fragments or how they're combined.
VirtualProgram on the other hand is a class derived from osg::Program. It lets you define a main part, and then prototypes which map to functions you will call in your main. You then attach shader fragments to the main and to each prototype. Then lower in the graph you can replace the VirtualProgram by another, or by an osg::Program, or you can just override one or several of the prototypes with other fragments (that define the same functions, but do it in different ways).
Even though VirtualProgram could be used to implement ShaderGen (by making a visitor that would override the right prototypes at the right points in the graph depending on states), the opposite isn't true. I think it's much more flexible and I'd like to see it go into the core, but of course that will have to be after more people have had a look at it (Wojtek submitted it a while ago and I don't remember many people talking about it - seems to have gone under the radar...).
J-S -- ______________________________________________________ Jean-Sebastien Guay [email protected] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
