using glReadPixels

i just want to make sure i know how to use it. i create a 1D array of int’s the size of 3widthheight, i send the pointer to the array beginning to the function, and than all the RGB value’s are inserted in this array value by value.
is that right?

Well, to be sure you should do
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
because other wise opengl will try to align lines to 4-byte boundaries. For example, if you have an rgb image that is 3pixels by 4pixels in size, you need
3*3 = 9 bytes
but opengl will align it to 4 byte boundaries (12 bytes) if you dont do what I said above.

im sorry, but i dont understand, what do u mean by alinging lines to 4 bytes? what lines?
and doesnt each pixel takes 3 bytes each?

With line I mean logical image lines.
Using my last example, opengl will expect the image to be stored like (3x4 rgb):
Where the - symbol represents a padding byte that is ignored.
Setting the packing alignment to 1 will expect:
rgbrgbrgb rgbrgbrgb rgbrgbrgb rgbrgbrgb
(ignore spaces, added them to illustrate the logical lines).
This is not only done in OpenGL, I know that in other APIs they align to 32bits word to, in order to optimize CPUs that work in 32bit rather than in 8bit.

i think i understand u now, i heared about this cpu optimization, using 4 byte vectors instead of just 3 (xyz and w), so why should i order opengl to pack the pixels in a 3 byte order, if i can manually skip the unusable forth one, and it might be faster, because of this cpu thing?

In some cases 32bit can be faster than 24bit even when it moves more data. It really depends, but it doesn’t matter too much. I simply set the unpack alignment to 1 and move on.

ok, thank u, i will do as u say.
i should only use the UNPACK parameter, not the PACK parameter, right? i dont deall with Packing.

yes, i think only unpack will do for you.