Problems with glReadPixels???

I have a textured scene and I read the frame buffer using:

glReadPixels (0, 0, winWidth, winHeight, GL_RGB, GL_UNSIGNED_BYTE, frameBuffer);

Than I write them in TGA format and mostly everything is OK. Mainly I get the correct images.

Anyway if I change only the texture files - sometimes only rotate a texture image in an external program-
I get distorted images (starting from below some parts are good and than some are shifted in
horizontal direction).

  1. something strange is happening inside glReadPixels?
  2. it is hardware-dependent - I get differently distorted images on different computers

Does anybody know what is happening and how to avoid these problems???

I would call glFlush before reading pixels.
Have you tried?

Also, make sure all your glPixelTransfer*() parameters are as you would expect. This is a common gotcha.

Thank you for your wish to help me but it doesn’t work!

  1. glFlush has nothing to do with it but I tried it anyway!
  2. the same for glPixelTransfer!

Two more conclusion from the tests I made:

  1. The problem occures ONLY for textured images (and not always as I have already described)!
  2. The glCopyPixels is working properly so the problem is in transfering the data into the processor memory!
    I have set GL_PACK_ALIGNMENT to 1 (glPixel Store) but that doesn’t help also!

I don’t see any solution ?
Please HELP!!!