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

Robert Osfield robert.osfield at gmail.com
Fri Jul 11 13:11:06 PDT 2008


Hi Alexandre,

If you are dynamically updating geometry you should disable display lists via:

  geometry->setUseDispayList(false);

Set this up on creation of your geometry.

Robert.

On Fri, Jul 11, 2008 at 8:49 PM, alexandre amyot murray
<alex.amyotmurray at gmail.com> wrote:
> 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
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list