Hi Sebastian, On 17 February 2015 at 15:37, Sebastian Messerschmidt < [email protected]> wrote:
> I've just refactored my previous ShaderComposition driven attempt to use > the new pragmatic scheme. (It turned out to be relatively easy) > Good to hear the change was straight forward. > At first glance the basics work fine, but I have some questions: > > 1. When will the debug output in console be removed? ;-) > Once it a bit more tested by the community :-) > > 2. I have some StateSet on top of a group representing my scene. Later > during rendering a new element is added, but with some additional define. > My naive expectation would be, that the new element will be using the > top-level program, recompiled with the new define. > Is this supposed to be working? What I want is to anonymously add some > define for my subgraph, not caring which top-state it has been placed > below. > Or do I somehow need to dirty something here to get a new Program (based > on the code of the program on top + my new define) built for this sub-graph? > The example does this - a leaf StateSet provides a new define and only the subgraph below that StateSet gets affected by GLSL program that takes into account that define. If multiple subgraphs all independently enable the same defines that they'll reuse the GLSL program. Even if alter an define via an update/cull callback the define will used to select the appropriate GLSL program during the draw traversal, and if the current define combination is different than any previous combination for the current osg::Program then a new GLSL shader and program objects will be compiled and linked. It should in theory just do what you ask it to do, no need to dirty osg::Program or osg::Shaders. One of the key goals is just make the developers life simple, just do what you ask it to do and get out the way. Robert.
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

