PDA

View Full Version : The color matrix and glDrawPixels()



02-22-2002, 11:37 AM
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!

chowe6685
02-22-2002, 05:05 PM
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

02-23-2002, 12:54 AM
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...

Korval
02-23-2002, 06:05 PM
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.

02-24-2002, 08:23 AM
Yeah, I might have to do that, but what if the size of the image isn't a power of 2?

DFrey
02-24-2002, 09:59 AM
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.