Hi, @David Callu :
> Your main problem is "how to handle fixed pipeline attribute/uniform in GLSL > Core profile?" Yes, but not only. My problem is also to handle application specific StateAttribute and to allow a way to specify different StateAttribute <=> GLSL binding for different applications. > If you change one attribute, you have to update the entire UBO. > ModelView matrix change for each drawable, so UBO is updated on each > drawable. I know this problem, but it appears only in the example I've provided, which is a very simple and not optimized one. As you can see in the osg::Pipeline class, all methods are pure virtual, and the choice to use a single uniform for each StateAttribute or a big UBO, or a mix between the two (eg a uniform for each matrix and a big UBO for materials) is made by the developper. With this approach, if you need performances, you can create your own optimized and specific pipeline, which maybe doesn't need to support every StateAttribute, but only a subset usefull in your application. I've also try to work with shader generators, but they are always problematic for me : for example you have to re-run the shader generator each time you add/remove a texture. With this osg::Pipeline class I can now write a single shader, bound it at the top a the scene graph (or a subgraph) and it reacts to every state change (as you can see in my example : the "T" key and the "L" key to toggle texturing and lighting are still working without any modification in the EventHandler and without re-generating shaders. A shader generator system also often need rendering logic both in C++ code (to build correct GLSL) and GLSL code (to execute the rendering), which is more complex to maintain and debug. My main goal here is to provide a customizable way to send all (or a subset) standard osg::StateAttribute (and customized ones) to the GPU to allow all the rendering logic to be coded in GLSL. As an example, I use this class in one of my application which renders objects in 2 views : a "standard OpenGL" one (basically a phong rendering) and a "thermic" one (with different modes : temperature, emissivity... values which are computed real time or offline from different algorithms). So I've defined several pipelines : - a Phong pipeline (which looks like the one I've provided in the example) - a "Render temperature" pipeline (very simple : doesn't handle any texture attribute, or any light source, or any osg::Material...) - a "Render emissivity" pipeline (very simple : doesn't handle any texture attribute, or any light source, or any osg::Material...) - a "Render XXX" pipeline (very simple : doesn't handle any texture attribute, or any light source, or any osg::Material...) And now I can : - switch between them by simply change the pipeline and change the "main" shader (at the top of the graph) - easily open multiple views with the same or different pipelines - any change on a StateAttribute is immediatly visible in all views @Robert : > I will put some time early next week to do a review. Thanks a lot ! Cheers, Aurelien ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53216#53216 _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
