adding rows together


I am using GLSL code to add the rows of a texture together.
So i take an nxn sized texture and make it a 1xn texture.

what is the easiest way to do this?

at the moment im using a for loop to do it. but for larger sized textures this is going to be slow.


I came right,

Thank you

If you want to reduce a large texture to 1xN or Nx1 you should always use a two-pass approach because GPUs typically process 2x2 fragment blocks. With a 1-wide render target you lose half the performance, so you want to perform the bulk of the work in a pass that uses a slightly larger render target. Also make use of texture filtering to reduce the number of texture fetches.