GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT specify how to (and whether or not to) pad each row of images that are read from and written to, respectively, OpenGL pipeline. Valid values are 1 (byte alignment), 2 (word alignment), 4 (dword alignment), and 8 (qword alignment). Defaults for both are 4. The calls are:
glPixelStorei(GL_PACK_ALIGNMENT, value);
glPixelStorei(GL_UNPACK_ALIGNMENT, value);
For example, if your GL_UNPACK_ALIGNMENT is 8, each image read from OpenGL (for example, with glReadPixels or glGetTexImage), whose (width * sizeof(one-pixel)) is not a multiple of 8, will be right-padded (in each row) to the nearest multiple of 8.
Likewise with GL_PACK_ALIGNMENT, except now we are talking about glDrawPixels and glTexImage1D/glTexImage2D. If GL_PACK_ALIGNMENT is 8, the OpenGL pipeline assumes that each row of image it is requested to read is right-padded to the nearest multiple of 8.
If your pack alignment is anything other than 1, you must take that into account when loading images, and either make sure that all your image (width * sizeof(one-pixel)) are a multiple of pack alignment or pad them accordingly. Likewise, if unpack alignment is not 1, make sure you allocate enough memory for the images you grab from the screen, or OpenGL may run out of bounds while writing pixeldata.
By the way there are other paramenters to glPixelStorei, but these are mostly related to endianness (whether you want bits in a byte from most significant to least significant or other way around, whether you want bytes in a word from most significant to least significant ot otherwise, etc) - these you might want to set depending on the platform you are working on, and the image formats you are loading.
[This message has been edited by Pa3PyX (edited 09-02-2002).]