Hello Francesco,

On Fri, 2007-08-31 at 15:22 +0200, Francesco Tamagni wrote:
> hi,
> i know that mine is not a new question but:
> "Why can't I add a Color4f to a Color4f property?"
> 
> more specifically, this code:
> 
> GeoColors4fPtr colors;
> colors = osg::GeoColors4fPtr::dcast(geo->getColors());
> if( colors == NullFC )
>       colors = GeoColors4f::create();
> 
> beginEditCP(colors, GeoColors4f::GeoPropDataFieldMask);
>       colors->addValue(Color4f(0,0,0,0));
> endEditCP(colors, GeoColors4f::GeoPropDataFieldMask);

the GeoProperties provide a generic interface that allows you to
manipulate them without necessarily knowing the exact type of the data
they hold. This allows one to write code that does not have to switch on
the exact type, but is also not quite as efficient as using the stored
type.
For best performance (and if you want to use data that is not
convertible to the type used for the generic interface), you need to
access the field of the property directly, like this:

// GeoColors4f::StoredFieldType == MFColor4f
GeoColors4f::StoredFieldType *pCol4f = colors->getFieldPtr();

beginEditCP(colors);
        pCol4f->push_back(Color4f(0.0f, 1.0f, 0.0f, 1.0f));
endEditCP  (colors);

        Hope it helps,
                Carsten


> gives me a compilation error like this:

> 'osg::GeoProperty<GeoPropertyDesc>::addValue': impossible to convert 
> parameter 1 from 'osg::Color4<ValueTypeT>' to 'const 
> osg::Color3<ValueTypeT> &'    
> 
> where is my fault?
> 
> thank you
> 
> francesco
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to