Finding indices of max value in texture

Hi,

In my application I need to find indices of maximum value in a texture. I’m using FBO and rendering to texture, so I can fetch texture data to CPU and do max finding there, but for 704x576x4 float texture it would take a lot of time.

Methods proposed here:finding max/min value in texture are, unfortunately, inapplicable - I do not need max value just that pixel coordinates.

Is there a way to find indices of maximum value in texture?

I do not need max value just that pixel coordinates.

In order to find one, you’ll need to find the other. So whether you need it or not, you will get it. The thread you linked to seems to cover the available options reasonably well.

Thank you for reply.

It’s kind of obvious, so yes, I’m aware of that.

With just one exception - output of all those solutions is only max value.
So after finding max I would have to perform a search on the image.

I was just wondering if I could avoid this second step.

Have you ever consider using CUDA for this task?

All you need to do is map a texture pointer for use in CUDA and maybe make use of some lib that already have this implemented, like Thrust .

They have a good example on finding the max and min values of a huge amount of data keeping the data on GPU.

I would if I could - I’m limited to pure OpenGL. And by the looks of the example you linked, this is huge limitation.

Anyway, it seems I’ll have to make do with parallel reduction with two textures (values & coordinates).