Hi,

Yes you can do it with a osg::BlendFunc, just like that :

osg::BlendFunc    *blendFunc = new osg::BlendFunc();
osg::BlendColor    *blendColor= new osg::BlendColor(osg::Vec4(1, 1, 1, 0.0
));

blendFunc->setSource(osg::BlendFunc::CONSTANT_ALPHA);
blendFunc->setDestination(osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);
node->getOrCreateStateSet()->setAttributeAndModes(blendFunc,
osg::StateAttribute::ON);
node->getOrCreateStateSet()->setAttributeAndModes(blendColor,
osg::StateAttribute::ON);

Then just update the blendColor's constant color (with
blendColor->setConstantColor()) by changing its alpha value.

I've done it by making a node callback which updates this value using a
simple timer.

On Feb 7, 2008 12:56 PM, Johan Johnsson <[EMAIL PROTECTED]> wrote:

> Hey all!
>
> I need a simple fade effect, is it possible to use osg::BlendFunc for
> this?
>
> osg::ref_ptr<osg::BlendFunc> wakeBlend = new osg::BlendFunc();
> wakeBlend->setFunction(osg::BlendFunc::DST_COLOR, osg::BlendFunc::ZERO);
>
> I whould like to increase the alpha value each frame, is there any way to
> define the alpha or transparacy using this osg::BlendFunc?, its actually
> only a model i load, which i want to fade (its a common bitmap) in and out
> over 2 seconds.
>
> --
> Mr. Johan Johnsson
> AutoSim AS, Strandveien 106, 9006 Tromsø
> Visit us at http://www.autosim.no
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Serge Lages
http://www.tharsis-software.com
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to