Hello Carsten, I followed your approach and tried to catch the interesting ShaderParameters once they are created. This is the source:
UInt32 numFC = osg::FieldContainerFactory::the()->getFieldContainerStore()->size(); for(UInt32 i = this->_prevNumFC; i < numFC; ++i) { osg::FieldContainerPtr fc = FieldContainerFactory::the()->getContainer(i); if(fc != osg::NullFC && fc->getType().isDerivedFrom(osg::ShaderParameter::getClassType())) { osg::ShaderParameterPtr sc = osg::ShaderParameterPtr::dcast(fc); if( sc->getName().size() >= 3 && sc->getName().substr(0,3) == "VDT") { this->_shaderParametersToUpdate.push_back( osg::RefPtr<osg::ShaderParameterPtr>(sc)); } } } this->_prevNumFC = numFC; Catching the required parameters works perfectly. After that I try to update them each frame. What I do is to iterate over the list of interesting ShaderParameterPtr's and call setValue(). The code for the system time looks like this: if((*paramIt)->getName() == "VDTSystemTime") { ShaderParameterRealPtr p = ShaderParameterRealPtr::dcast((*paramIt).get()); if( p != osg::NullFC ) { beginEditCP(p, ShaderParameterReal::ValueFieldMask); p->setValue(systemTimeVar); endEditCP(p, ShaderParameterReal::ValueFieldMask); } } The code compiles and runs fine. But the parameter seems to be not applied to the shader. Do I miss something? Thanks, Michael Am 15.02.2011 20:28, schrieb Carsten Neumann: > Hello Michael, > > On 02/15/2011 10:45 AM, Michael Raab wrote: >> I'll try to update the required timer uniforms before rendering and let >> the cluster distribution getting care of the distribution. Is there a >> way to recognize if a SHLChunk is getting created or if a new uniform >> gets attached to a SHLChunk or can I somehow fetch a FieldContainers of >> type SHLChunk? > not in 1.x, there the best you can probably do is query the > FieldContainerFactory: > > static UInt32 prevNumFC = 0; > UInt32 numFC = > FieldContainerFactory::the()->getFieldContainerStore()->size(); > > for(UInt32 i = prevNumFC; i< numFC; ++i) > { > > if(FieldContainerFactory::the()->getContainer(i)->getType().isDerivedFrom(SHLChunk::getClassType())) > { > // new SHLChunk > } > } > > prevNumFC = numFC; > >> Am 11.02.2011 17:41, schrieb Carsten Neumann: >>> On 02/10/2011 01:50 PM, Michael Raab wrote: >>>> the problem is that I need to know each SHLChunk in my scene tree. >>>> Imagine meshes are loaded and unloaded during runtime, I need to make >>>> sure that all appropriate SHLChunk instances get the appropriate update >>>> callback assigned. >>> hmm, your meshes are stored as .osb then or do you run some form of >>> post-processing after loading? >>> Either way, the SHLChunks have to be created at some point and other >>> parameters must be added to them, can't you fit this in there? > hmm, I guess there is a reason this is not feasible in your application, > but isn't there some point where you add other parameters to the > SHLChunks? Can you just put them in a list then so that you have easy > access to them later when you need to update the values? To clear out > unused chunks you could check the ref count, if it's<= 1 only the list > of chunks holds a ref to it and you can drop it. > > Cheers, > Carsten > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > Opensg-users mailing list > Opensg-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/opensg-users > ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users