Hi All,

I have a texture generated on the fly (via FBO) with the model shadow. This is a black and transparent texture with - of course - many stair steps between (on/off) pixels.

I was thiking to add Gaussian Blur on the whole bitmap. I found the algorithm you see below but it works pixel by pixel.

Now the questions are:

1) Does OpenGL provide some built in algorithm to do this?
2) What is the fastest method to change pixel color on a texture?
3) Does some other different approach exist to obtain the same result?

Thanks so much as usually!

Alberto

Code :
#define gauss_width 7
 
sumr=0;
sumg=0;
sumb=0;
 
int gauss_fact[gauss_width]={1,6,15,20,15,6,1};
int gauss_sum=64;
 
for(i=1;i<temp->w-1;i++){
  for(j=1;j<temp->h-1;j++){
    sumr=0;
    sumg=0;
    sumb=0;
    for(k=0;k<gauss_width;k++){
      color=getpixel(temp,i-((gauss_width-1)>>1)+k,j);
      r=getr32(color);
      g=getg32(color);
      b=getb32(color);
      sumr+=r*gauss_fact[k];
      sumg+=g*gauss_fact[k];
      sumb+=b*gauss_fact[k];
 
    }
    putpixel(temp1,i,j,makecol(sumr/gauss_sum,sumg/gauss_sum,
      sumb/gauss_sum));
  } 
}
 
for(i=1;i<temp->w-1;i++){
  for(j=1;j<temp->h-1;j++){
    sumr=0;
    sumg=0;
    sumb=0;
    for(k=0;k<gauss_width;k++){
      color=getpixel(temp1,i,j-((gauss_width-1)>>1)+k);
      r=getr32(color);
      g=getg32(color);
      b=getb32(color);
 
      sumr+=r*gauss_fact[k];
      sumg+=g*gauss_fact[k];
      sumb+=b*gauss_fact[k];
    }
    sumr/=gauss_sum;
    sumg/=gauss_sum;
    sumb/=gauss_sum;
 
    putpixel(temp2,i,j,makecol(sumr,sumg,sumb));
  } 
}