The color matrix and glDrawPixels()

Hi!

When I draw an image with glDrawPixels() everything works fine. But when I change the contrast or brightness with glScalef() and glTranslatef() on the color matrix, the rendering slows down A LOT! This only happen when I draw with glDrawPixels(). Is it supposed to be like that? Is there any way to make it faster?

Thanks!

I don’t think the color matrix is hardware accelerated on any commercial cards right now, so it will be slow. You could try emulating the color matrix yourself, though I don’t know if you could make it much faster

But it is slow only when I draw things with glDrawPixels(). When I draw textured quads or triangles and make changes to the color matrix it’s as fast as if I would’nt modify the color matrix…

On most consumer cards, glDrawPixels is not a highly acceleratted function. You might be better off uploading the pixels to a texture and drawing that.

Yeah, I might have to do that, but what if the size of the image isn’t a power of 2?

Two options, if a texture rectangle extension is available, use it. Otherwise resize the image to the next greatest or equal power of two in each dimension, or just increase the size of the image by simply adding blank space to the right and bottom, and use the correct texture coordinates to address the corner of the texture with the image.