I have drawn an image file with the GIMP and saved it as a .c file. Then I used the following in my OpenGL code to load the image onto the screen:
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glRasterPos2i(x_disp, 0);
glDrawPixels(80, 80, GL_RGB, GL_UNSIGNED_BYTE, gimp_image.pixel_data);
However the image loaded appear flipped 180 degrees upside down. I wonder whether there is an option I can supply in OpenGL so that I can have the image rendered with the same orientation as in GIMP, with the top side up, and the left side on the left, perhaps with glPixelStore or some other OpenGL function call to specify how to unpack the pixels?
OpenGL assumes image data in the lower left corner, whereas most image manipulation programs place it in the upper left corner.
Instead of glDrawPixels use a texture, then you can just flip texture coordinates. glDrawPixels is a extremly slow CPU-cycle sucker anyway and has been removed from OpenGL-3 and later. Just don't use it.