Hi Fred, On Mon, May 9, 2011 at 3:42 PM, Fred Smith <osgfo...@tevs.eu> wrote: > It means that there seems to be a cost in doing state changes with OSG.
Indeed there is!! It's written to be lightweight, using pointer rater than content comparisons where possible, but you can't ever disappear CPU cycles completely. This work that the OSG does on state is to minimize the number of state changes sent to OpenGL, so while there is a higher CPU cost, the GPU cost is lower. > GL state changes do not necessarily incur any cost - this is implementation > specific anyway - whereas OSG state changes seem to always incur one, as even > going through empty statesets does incur a cost. Some GL state changes are relatively lightweight, but since any GL call overhead itself is not cheap, avoid GL calls is worth the effort, and some GL state changes are hugely expensively. The OSG does state sorting and lazy state updating to make sure that the graphics is sent to the GPU as efficiently as it can. As for empty StateSets, the OSG during traversal doesn't know a StateSet is empty until it checks it contents, do so waste time of course, but there is nothing the OSG can do during traversal to avoid this. However, an empty StateSet is a indication of very poorly set up scene graph. Efficient scene graph don't have rendundent StateSet or Node's in the scene graph, the osgUtil::Optimizer contains are plarethora of visitors to help condition poorly balanced scene graphs, so if you do have a problem scene graph the Optimizer is a great tool to utilize as a pre-processing step. Performance problems that end users see are almost always caused by scene graphs that are poorly constructed for the purpose that have been created for, so if you see high update, cull and draw dispatch and draw GPU investigate the bottlenecks with a view to understanding what in your scene graph is introducing the large overheads. The skill of creating an optimal scene graph isn't a trivial one though, it's one of the core skills for real-time graphics experts to develop, a skill that takes many years to mature. I am still a learning, and don't really every expert to stop learning about this as technology continues to evolve at a break-neck speed. Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org