Texture average color

Does anyone know a fast (which probably means GPU based) solution for finding an average color on a texture?

I was thinking of mipmapping, but there seems to be no way of extracting the mipmaps generated by Panda, or I haven’t been able to find a way to do such thing.

ThomasEgi pointer me at PNMImage AverageXelA method, which looks promising (certainly is a lot faster than doing that from Python would be), but that brings up another question.

Consider this pipeline for rendering a scene with floating point textures applied:

Offscreen Buffer -> Texture set to TFloat -> PNMImage

In this case, would the full, floating point precision (32 bit per channel, right?) be kept through the whole process? Only this way averaging it makes sense for my use. And, if it would, would I need to set the buffer or camera in any special way, or would it just work?

Thanks in advance.

Just keep making smaller and smaller offscreen buffers in a chain until you get to a 1x1 tex. That is your average color.