View Full Version : Simple question about Reduction !

Wonwoo Lee
06-08-2011, 06:43 PM

I looked some codes implementing the reduction for mean value computation in GLSL.

In the code, a rectangle is rendered in a half size of the previous level to sum 2x2 block of the data.

Let me assume, I have a original texture T0 and it is rendered in half size to reduce it to the level 1.

From the viewpoint of a fragment shader, the first fragment, F(u0,v0), should access the texels at (0,0), (1,0), (0,1), and (1,1).

Then, the next fragment F(u0 +1, v0) should access the texels at (2,0), (3,0), (2,1), and (3,1). So the texture coordinate of the fragment should be (2,0).

In the same way, the texture coordinates of F(u0, v0+1) should be (0,2).

(Here, I didn't use the normalized coordinates for convenience)

What I wonder is that rendering a rectangle in half size automatically move the texture coordinates in the step of 2 ?

If I want to work with 7x7 blocks, (reduction is 2x2 case), should I render a rectangle in 1/7 size of the original texture ?