View Full Version : glDrawPixels

10-18-2003, 01:56 PM
Hi am having a problem with glDrawPixels that mabye some one can help me with.
If the width is not a multiple of 4 I am getting the first line(the bottom line) comming out right and then every line above that the pixels are all wrong.

An example is the following
unsigned char picture[10*3] = {0};
for(int i =0; i < 30; i++){
picture[i] = 255;
glPixelZoom ( 20,20);

The bottem line is read and the top line is BLUE?? Can any one help?

10-18-2003, 02:20 PM
Look up unpack alignment (glPixelStore and GL_UNPACK_ALIGNMENT). Unpack alignment tells OpenGL the alignment of the start of each row in the source image relative the start address.

10-19-2003, 07:58 AM
Thank you so much, I was scratching my head all yesterday trying to figure out what the problem was. That did it. Stupid 4 byte allignment http://www.opengl.org/discussion_boards/ubb/smile.gif