PDA

View Full Version : adding rows together



The Ordinary
11-11-2008, 07:22 AM
Hi

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.

Thanks

The Ordinary
12-11-2008, 01:13 AM
I came right,

Thank you

Xmas
12-11-2008, 02:58 AM
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.