reducing images

after rendering an image, is there an easy way to create another image say 1/10th the size consisting of the 1st, 11th, 21st pixels etc?
and then another with the 2nd, 12th, 22nd pixels and so on?

thanks,
hu.

Two ways I know about.

#1 Use glReadPixels and extract the pixels yourself.
#2 Copy the image to a texture, use GL_NEAREST as minification filter, draw a quad and pass it the necessary texture coordinates to make it hit the pixels you want.

I can for sure say, if you don’t know to 100% how the texel-hit stuff works in OpenGL, I would strongly recomend #1.

Clarify wtf it is you’re doing. And you don’t want to use any glxxxxPixels functions, for they eat the hell out of your performance. If you want to take an image out of the framebuffer, then you should put the framebuffer to where you can get it more easily, like a memory DC. At least it isn’t as slow as glReadPixels… :stuck_out_tongue:

And why use GL_NEAREST when anisotrophic filtering looks so much better than even mipping? :stuck_out_tongue: If you can’t do that, use GL_LINEAR_MIPMAP_LINEAR; it will look lots better. That is, if you’re going to use the god-awful-slow-to-read-from framebuffer.

If you use my memory context idea, then you’ll have to figure out linear interpolation or texel hitting (the former is better looking, but more CPU intensive and much harder to code) however. I dunno, I’m just tired and I babble on pointlessly because I have nothing better to do.

I didn’t advice him to use GL_LINEAR because it looks good, I did it because GL_LINEAR uses only one texel. GL_LINEAR_MIPMAP_LINEAR is a weighted average of the eight surrounding texels, and it might be a bit difficult to hit a single texel only with that minification filter. With GL_LINEAR, a certain “fault” in texture coordinates is OK.

GL_NEAREST!

after rendering an image,

Are you rendering with OpenGL?

is there an easy way to create another image say 1/10th the size consisting of the 1st, 11th, 21st pixels etc?
and then another with the 2nd, 12th, 22nd pixels and so on?

What will you be using it for? Is the image rendered every frame or more seldom? One thing to consider is that when downsampling an image, you should low pass filter it before subsampling (basically what FSAA does) if each subsampled image is to be viewed separately.

/Marcus

Michael, you are so correct. I was right in my first post, but wrong in my second. GL_NEAREST is what I meant instead of GL_LINEAR. Typo, or just a tired head, I don’t know

does any1 know about an acceleratet method for making a texture smaller by 2,4,8,etc. ??

i can do it in the cpu but i think gpu could be faster?

Originally posted by doodlemunch:
[b]does any1 know about an acceleratet method for making a texture smaller by 2,4,8,etc. ??

i can do it in the cpu but i think gpu could be faster?[/b]
Simply use mipmaps if that’s what you was meaning.