oversampling and glPixelZoom, etc

Hi All,

I have the need to “oversample” images in OpenGL, and am not overly sure about how to do this.

Imagine a 99 pixel image. Also imagine that you need a 33 image from this. Everything would seem simple enough. Obviously, the oversampling rate is 3, so we split the 99 image into seperate 33 sections, and average the (colour) sum of each section to produce the pixel values for the 3*3 result. Computationally not that difficult, but where does glPixelZoom fit into the picture?! From my understanding, glPixelZoom doesn’t perform this type of “oversampling”, rather it “downsamples” because it looses colour information, i.e. does not average colour over a pixel section.

In the aforementioned case, to create the 33 image, glPixelZoom would only use 9 pixels from the original 99 image. This is because glPixelZoom only uses those pixels of the original 99 image whose centres overlap the centres of the new 33 image. (Obviously I am describing this with a visualisation of the 99 image overlayed with the resulting 33 image)

This is my understanding from the “Red” book and the appropriate man page, but I thought I had better ask if I am correct or not. So does this operation of glPixelZoom sound correct?!

So now what about when the 33 image is “floating” inside the 99 image, i.e. the pixel boundaries do not line up. What if the new image size is not only “floating” in the original, but is not an integer value?! In this case, values for the oversampled image may very well be calculated from many different fractional pixel values and so forth.

It seems like the only way to oversample in this case is to perform pixel manipulation and computation in something else like C, then redraw the results to another window.

Apart from the correctness of my glPixelZoom understanding, does anyone have experience with oversampling like I have commented on, or any suggestions on OpenGL functions which may prove extremely useful in this case?!

Many thanks.

Tim Sills