Comparing 2 Images

Hi,

I am trying to compare two image files with same height and width.

I am trying to read the values from the images pixel by pixel and then comparing them using the glReadPixel (…) command.

Does anybody have an idea on how to compare two images to the finest of details?

Is there a better way than glReadPixel(…) to do the same?

Thanks,

Bhaji

Read the whole image to a buffer and then use either memcmp (for C) or equal (for C++) to compare the data. Check some documentation for info on the tow functions. If you use another language, I can’t help.

A nice way is to use one of the “operations”, such as XOR.

Render image 1
SetOpMode(XOR)
Render image 2

but I think for GL it only works in colorindex mode.

Doing a DOT product operation would work also, but then you would have to enter the realm of textures.

I’m sure more can be suggested…

V-man

>>but I think for GL it only works in colorindex mode.<<

No, glEnable knows GL_COLOR_LOGIC_OP for RGBA and GL_INDEX_LOGIC_OP for color index mode since OpenGL 1.1

[This message has been edited by Relic (edited 11-08-2002).]