Hello Carsten, thanks, both hints worked. The callback gets now called as expected. Remains the problem, that if I update the ShaderParameter via setValue(), the appropriate changes are not applied as the ParameterField of the SHLChunk gets not marked as changed. The callback function provides only a pointer to the ShaderParameter, theres no connection between Parameter and SHLChunk. Do you think it is possible to deliver both, the ShaderParameter and the SHL as parameter of the callbacks? Do you see any drawbacks?
Second question. I saw that if a add a callback for a specific parameter that does not exist, a dummy parameter is created. Is that necessary? So in my case, if a add a callback to each SHLChunk that gets created, each chunk tries to update each frame, independent of whether we assigned a timer variable or not. That may be not very fast... Thanks, Michael Am 09.03.2011 16:32, schrieb Carsten Neumann: > Hello Michael, > > On 03/09/2011 07:11 AM, Michael Raab wrote: >> UInt32 numFC = >> FieldContainerFactory::the()->getFieldContainerStore()->size(); >> >> // Loop over all newly created field container instances >> for(UInt32 i = this->_prevNumFC; i< numFC; ++i) >> { >> FieldContainerPtr fc = FieldContainerFactory::the()->getContainer(i); >> >> if(fc != osg::NullFC&& >> fc->getType().isDerivedFrom(osg::SHLChunk::getClassType())) >> { >> SHLChunkPtr shl = SHLChunkPtr::dcast(fc); >> if( shl != NullFC ) >> { >> beginEditCP(shl); >> shl->addParameterCallback("VDTSystemTime", updateP); >> shl->addParameterCallback("VDTSystemTime", updateU); >> endEditCP(shl); >> } >> >> cout<< "Found shl chunk"<< endl; >> } >> } >> >> this->_prevNumFC = numFC; >> Am I doing something wrong? > try naming your parameters starting with "OSG", it appears the user > callbacks are moved to _osgParametersCallbacks at some point, but only > if they start with "OSG" - not sure what the reason for this is/was. > >> One additional thing I have discovered. If I try to attach the callbacks to >> the very first SHLChunk I discover, I get an AccessViolation. Furthermore I >> haven't created that SHLCHunk. Is it something like a prototype? Can I >> somehow find out if its a prototype or something special? > yes, that is probably the prototype. If you can create the object that > adds the callbacks above before the first real SHLChunk is created, you > can simply init _prevNumFC when it is created to size of the container > store at creation time. > Alternatively you can access the prototype from the containers type > object, shl->getType().getPrototype(), and compare the pointers. > > Cheers, > Carsten > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > Opensg-users mailing list > Opensg-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/opensg-users > ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users