apapaxionga
04-09-2011, 06:15 AM
in the orange book , it says that the fellowing code using sixteen samples per fragment to generate antialiased edges,but i do not understand why sixteen samples. the code just choose the those (-1,-1)(1,1)(1,-1)(-1,1) for samples ,why sixteen? the type of the return value of textureProjOffset is gvec4,but the type of sum is float ,why?
float sum;
sum=textureProjOffset(ShadowMap,ShadowCoord,ivect(-1,-1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (-1,1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (1,-1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (1,1));
float sum;
sum=textureProjOffset(ShadowMap,ShadowCoord,ivect(-1,-1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (-1,1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (1,-1));
sum+=textureProjOffset(ShadowMap,ShadowCoord,ivect (1,1));