[osg-users] problem modifying alpha channel of a geometry

alexandre amyot murray alex.amyotmurray at gmail.com
Fri Jul 11 12:49:57 PDT 2008


Hi,

I have a plane built with 60X60 vertex and I constantly update the alpha
channel of these vertex to create a specific effect for my application. When
I launch the application, everything runs fine for a while, but comes a time
where everything starts to lag.

Do you know why such a thing happens ?

I use this code to update alpha channel :

    // Slowly affect the alpha
    osg::Vec4Array* colorArray =
((osg::Vec4Array*)myGeometry_->getColorArray());
    for( unsigned int i=0; i<colorArray->size(); i++ )
    {
        if( (colorArray->at( i )).a() < 1.0 )
        {
            double alpha = (colorArray->at( i )).a() + alphaIncrement_;
            if( alpha > 1.0 )
                alpha = 1.0;

            if( alpha >= 0.0 )
               (colorArray->at( i ))[3] = alpha;
        }
    }

    myGeometry_->dirtyDisplayList();

thanks

Alexandre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080711/6d5d4d55/attachment-0002.htm>


More information about the osg-users mailing list